/ Check-in [4bb854dd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When calling fopen() in the zonefile extension, use modes "rb" and "wb" instead of "r" and "w". This makes no difference on unix, but is required when accessing binary files on other systems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | zonefile
Files: files | file ages | folders
SHA3-256:4bb854ddd9c1dc2972fd4f7c2c2b2d121caa662d5085694c2dbb35d331a61444
User & Date: dan 2018-02-15 15:17:42
Context
2018-02-15
15:24
Fix another point in zonefile.c so that all files are opened in either "rb" or "wb" mode. check-in: fb1c2277 user: dan tags: zonefile
15:17
When calling fopen() in the zonefile extension, use modes "rb" and "wb" instead of "r" and "w". This makes no difference on unix, but is required when accessing binary files on other systems. check-in: 4bb854dd user: dan tags: zonefile
2018-02-13
21:16
Fix formatting errors in ext/zonefile/README.md. check-in: a2221e35 user: dan tags: zonefile
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/zonefile/zonefile.c.

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
    rc = fread(aBuf, 1, nBuf, pFd);
    rc = (rc==nBuf) ? SQLITE_OK : SQLITE_ERROR;
  }
  return rc;
}

static FILE *zonefileFileOpen(const char *zFile, int bWrite, char **pzErr){
  FILE *pFd = fopen(zFile, bWrite ? "w" : "r");
  if( pFd==0 ){
    *pzErr = sqlite3_mprintf("failed to open file \"%s\" for %s",
        zFile, bWrite ? "writing" : "reading"
    );
  }
  return pFd;
}







|







344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
    rc = fread(aBuf, 1, nBuf, pFd);
    rc = (rc==nBuf) ? SQLITE_OK : SQLITE_ERROR;
  }
  return rc;
}

static FILE *zonefileFileOpen(const char *zFile, int bWrite, char **pzErr){
  FILE *pFd = fopen(zFile, bWrite ? "wb" : "rb");
  if( pFd==0 ){
    *pzErr = sqlite3_mprintf("failed to open file \"%s\" for %s",
        zFile, bWrite ? "writing" : "reading"
    );
  }
  return pFd;
}