From 577d674f1a0ae6dd0f7272392caa107b492bac9d Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 7 Apr 2009 00:35:20 +0000 Subject: [PATCH] It is OK for a unix file descriptor to be zero. It just can't be negative. Adjust an assert accordingly. Ticket #3781. (CVS 6457) FossilOrigin-Name: 47aa7eb0e047e30bbf09cb08c1e48c61f8d9861c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index de04399b14..64aa71014f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\scases\sand\sminor\scode\schanges\sto\sincrease\scoverage\sof\sbtree.c.\s(CVS\s6456) -D 2009-04-06T17:50:03 +C It\sis\sOK\sfor\sa\sunix\sfile\sdescriptor\sto\sbe\szero.\s\sIt\sjust\scan't\sbe\snegative.\nAdjust\san\sassert\saccordingly.\s\sTicket\s#3781.\s(CVS\s6457) +D 2009-04-07T00:35:20 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -141,7 +141,7 @@ F src/os.c c2aa4a7d8bb845222e5c37f56cde377b20c3b087 F src/os.h fa3f4aa0119ff721a2da4b47ffd74406ac864c05 F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 -F src/os_unix.c 5d667f24615043c937a138faaed5f3e93b8619b0 +F src/os_unix.c e5eef59cfb0f646b5010bc597b7c4a91534efc9b F src/os_win.c 524fe4c31c469531191857e8036ef59bfb52d684 F src/pager.c 1df277b7c78f780df119c9e2ddea6690979489c5 F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f @@ -715,7 +715,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P aea99c572a69a00b709f0de816ea16488d899375 -R 7bc7fd3a531ebb9367938d84424724ab -U danielk1977 -Z fda09d8876bea1757fca4f0d05a68a01 +P def3a016914f683818b5f013ec4efecbb8fd4c0d +R dd09bd0133bdadedbd1d713686ab1fb9 +U drh +Z 8bf6995ce628580cd1999c568866c0af diff --git a/manifest.uuid b/manifest.uuid index 0dd28061b1..23aad20555 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -def3a016914f683818b5f013ec4efecbb8fd4c0d \ No newline at end of file +47aa7eb0e047e30bbf09cb08c1e48c61f8d9861c \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 719f16c871..75f595326f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -43,7 +43,7 @@ ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). ** -** $Id: os_unix.c,v 1.248 2009/03/30 07:39:35 danielk1977 Exp $ +** $Id: os_unix.c,v 1.249 2009/04/07 00:35:20 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -3613,7 +3613,7 @@ static int unixOpen( int flags, /* Input flags to control the opening */ int *pOutFlags /* Output flags returned to SQLite core */ ){ - int fd = 0; /* File descriptor returned by open() */ + int fd = -1; /* File descriptor returned by open() */ int dirfd = -1; /* Directory file descriptor */ int openFlags = 0; /* Flags to pass to open() */ int eType = flags&0xFFFFFF00; /* Type of file to open */ @@ -3716,7 +3716,7 @@ static int unixOpen( } #endif - assert(fd!=0); + assert( fd>=0 ); if( isOpenDirectory ){ rc = openDirectory(zPath, &dirfd); if( rc!=SQLITE_OK ){