mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
For lsmtest, use a more portable means of setting open() files to binary.
FossilOrigin-Name: aea6e0ffd33f41482f1b53b9f21b77add2865abda4eec1d9ee197177f74f43d0
This commit is contained in:
@ -15,6 +15,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _O_BINARY
|
||||
# define _O_BINARY (0)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include "windows.h"
|
||||
# define gettimeofday win32GetTimeOfDay
|
||||
|
@ -269,8 +269,8 @@ static void copy_file(const char *zFrom, const char *zTo, int isDatabase){
|
||||
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;
|
||||
|
@ -227,7 +227,7 @@ int do_io(int nArg, char **azArg){
|
||||
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;
|
||||
|
@ -1240,7 +1240,7 @@ static int do_writer_test(int nArg, char **azArg){
|
||||
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;
|
||||
@ -1523,10 +1523,6 @@ int main(int argc, char **argv){
|
||||
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 ){
|
||||
|
Reference in New Issue
Block a user