Index: src/os_unix.c ================================================================== --- src/os_unix.c +++ src/os_unix.c @@ -41,11 +41,11 @@ ** * sqlite3_vfs method implementations. ** * Locking primitives for the proxy uber-locking-method. (MacOSX only) ** * 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 */ /* @@ -3611,11 +3611,11 @@ const char *zPath, /* Pathname of file to be opened */ sqlite3_file *pFile, /* The file descriptor to be filled in */ 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 */ int noLock; /* True to omit locking primitives */ int rc = SQLITE_OK; @@ -3714,11 +3714,11 @@ if( (flags & SQLITE_OPEN_MAIN_DB)!=0 ){ ((unixFile*)pFile)->isLockable = 1; } #endif - assert(fd!=0); + assert( fd>=0 ); if( isOpenDirectory ){ rc = openDirectory(zPath, &dirfd); if( rc!=SQLITE_OK ){ close(fd); /* silently leak if fail, already in error */ return rc;