Skip to content

Commit d478d17

Browse files
author
Ilia Alshanetsky
committed
MFH: Fixed bug #27928 (sqlite incorrectly handles invalid filenames).
1 parent 230aea0 commit d478d17

File tree

1 file changed

+6
-0
lines changed
  • ext/sqlite/libsqlite/src

1 file changed

+6
-0
lines changed

ext/sqlite/libsqlite/src/os.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
# ifndef O_BINARY
3535
# define O_BINARY 0
3636
# endif
37+
# ifndef EISDIR
38+
# define EISDIR 21
39+
# endif
3740
#endif
3841

3942

@@ -464,6 +467,9 @@ int sqliteOsOpenReadWrite(
464467
id->dirfd = -1;
465468
id->fd = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
466469
if( id->fd<0 ){
470+
if (errno == EISDIR) {
471+
return SQLITE_CANTOPEN;
472+
}
467473
id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
468474
if( id->fd<0 ){
469475
return SQLITE_CANTOPEN;

0 commit comments

Comments
 (0)