From: drh Date: Fri, 30 Aug 2013 14:24:12 +0000 (+0000) Subject: Add the SQLITE_MINIMUM_FILE_DESCRIPTOR compile-time option, for control over X-Git-Tag: version-3.8.1~113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77a3fdc1b063dd3775fa1da843d5cc404fdf3f1c;p=thirdparty%2Fsqlite.git Add the SQLITE_MINIMUM_FILE_DESCRIPTOR compile-time option, for control over exactly which low-numbered file descriptors SQLite will use. FossilOrigin-Name: ba5190534330a25722eeb7ea9c42da7a6d146014 --- diff --git a/manifest b/manifest index 5c27035d74..56b314ac29 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stest\sfor\sfts4\sunicode61\soption\sremove_diacritics=0. -D 2013-08-30T13:29:51.754 +C Add\sthe\sSQLITE_MINIMUM_FILE_DESCRIPTOR\scompile-time\soption,\sfor\scontrol\sover\nexactly\swhich\slow-numbered\sfile\sdescriptors\sSQLite\swill\suse. +D 2013-08-30T14:24:12.062 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -202,7 +202,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 -F src/os_unix.c 81271e38084e74ddc6602ee5a80ea0a7d5dfacf9 +F src/os_unix.c 7d5f3c51db561804e3ff3d47970a58bc6ea4d662 F src/os_win.c 26d752736dff0c7e4e384ab65b353cce1e7e19c5 F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8 F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c @@ -1109,7 +1109,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P d9c018f8155ab48df8e0e02519bba50588fe49fc -R ea091c59207c769dfe7c01daedbc5f93 -U dan -Z c2684be8ef49bf7c2f428934c35768a0 +P 6bf7ae6ff6b18712544ddeafb6848b3b27ff22d2 +R f869b9c4782ea4938d88f3fd8f2e185a +U drh +Z 55a1a5eb28d49163aa7c79ea9937ef28 diff --git a/manifest.uuid b/manifest.uuid index 47941bce42..cbc2987dde 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6bf7ae6ff6b18712544ddeafb6848b3b27ff22d2 \ No newline at end of file +ba5190534330a25722eeb7ea9c42da7a6d146014 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 8688a652f5..797ace031d 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -551,6 +551,15 @@ static const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){ return 0; } +/* +** Do not accept any file descriptor less than this value, in order to avoid +** opening database file using file descriptors that are commonly used for +** standard input, output, and error. +*/ +#ifndef SQLITE_MINIMUM_FILE_DESCRIPTOR +# define SQLITE_MINIMUM_FILE_DESCRIPTOR 3 +#endif + /* ** Invoke open(). Do so multiple times, until it either succeeds or ** fails for some reason other than EINTR. @@ -581,7 +590,7 @@ static int robust_open(const char *z, int f, mode_t m){ if( errno==EINTR ) continue; break; } - if( fd>2 ) break; + if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break; osClose(fd); sqlite3_log(SQLITE_WARNING, "attempt to open \"%s\" as file descriptor %d", z, fd);