/ Check-in [e3054650]
Login

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

Overview
Comment:Prevent sqlite from opening directories as databases under unix. Fix for test cae in misc7.test. (CVS 4342)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e30546504c59c7d92d83a32d9b7e83edc175e247
User & Date: danielk1977 2007-08-30 16:13:34
Context
2007-08-30
16:23
Make the latest interfaces usable by loadable extensions. (CVS 4343) check-in: e9b2700b user: drh tags: trunk
16:13
Prevent sqlite from opening directories as databases under unix. Fix for test cae in misc7.test. (CVS 4342) check-in: e3054650 user: danielk1977 tags: trunk
15:46
Check in extra fixes for malloc4.test. (CVS 4341) check-in: 49ce3a83 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/os_unix.c.

  2391   2391     if( isReadWrite ) oflags |= O_RDWR;
  2392   2392     if( isCreate )    oflags |= O_CREAT;
  2393   2393     if( isExclusive ) oflags |= (O_EXCL|O_NOFOLLOW);
  2394   2394     oflags |= (O_LARGEFILE|O_BINARY);
  2395   2395   
  2396   2396     memset(pFile, 0, sizeof(unixFile));
  2397   2397     fd = open(zPath, oflags, isDelete?0600:SQLITE_DEFAULT_FILE_PERMISSIONS);
  2398         -  if( fd<0 && isReadWrite && !isExclusive ){
         2398  +  if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){
  2399   2399       /* Failed to open the file for read/write access. Try read-only. */
  2400   2400       flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
  2401   2401       flags |= SQLITE_OPEN_READONLY;
  2402   2402       return unixOpen(pVfs, zPath, pFile, flags, pOutFlags);
  2403   2403     }
  2404   2404     if( fd<0 ){
  2405   2405       return SQLITE_CANTOPEN;