Index: ext/lsm1/lsm-test/lsmtest.h ================================================================== --- ext/lsm1/lsm-test/lsmtest.h +++ ext/lsm1/lsm-test/lsmtest.h @@ -12,10 +12,14 @@ #include #ifdef __cplusplus extern "C" { #endif + +#ifndef _O_BINARY +# define _O_BINARY (0) +#endif #ifdef _WIN32 # include "windows.h" # define gettimeofday win32GetTimeOfDay # define F_OK (0) Index: ext/lsm1/lsm-test/lsmtest6.c ================================================================== --- ext/lsm1/lsm-test/lsmtest6.c +++ ext/lsm1/lsm-test/lsmtest6.c @@ -267,12 +267,12 @@ off_t sz; off_t i; struct stat buf; u8 *aBuf; - fd1 = open(zFrom, O_RDONLY, 0644); - fd2 = open(zTo, O_RDWR | O_CREAT, 0644); + fd1 = open(zFrom, O_RDONLY | _O_BINARY, 0644); + fd2 = open(zTo, O_RDWR | O_CREAT | _O_BINARY, 0644); fstat(fd1, &buf); sz = buf.st_size; ftruncate(fd2, sz); Index: ext/lsm1/lsm-test/lsmtest_io.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_io.c +++ ext/lsm1/lsm-test/lsmtest_io.c @@ -225,11 +225,11 @@ return -1; } aData = malloc(pgsz); memset(aData, 0x77, pgsz); - ctx.fd = open(zFile, O_RDWR|O_CREAT, 0644); + ctx.fd = open(zFile, O_RDWR|O_CREAT|_O_BINARY, 0644); if( ctx.fd<0 ){ perror("open: "); return -1; } Index: ext/lsm1/lsm-test/lsmtest_main.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_main.c +++ ext/lsm1/lsm-test/lsmtest_main.c @@ -1238,11 +1238,11 @@ } printf("Preparing file... "); fflush(stdout); unlink("writer.out"); - fd = open("writer.out", O_RDWR|O_CREAT, 0664); + fd = open("writer.out", O_RDWR|O_CREAT|_O_BINARY, 0664); if( fd<0 ){ testPrintError("open(): %d - %s\n", errno, strerror(errno)); return -1; } testTimeInit(); @@ -1521,14 +1521,10 @@ const char *zReport = "malloc.txt generated"; #else const char *zReport = "malloc.txt NOT generated"; #endif -#if defined(_MSC_VER) || defined(__MSVCRT__) - _set_fmode(_O_BINARY); -#endif - testMallocInstall(tdb_lsm_env()); if( argc<2 ){ testPrintError("Usage: %s sub-command ?args...?\n", argv[0]); return -1;