]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Set FD_CLOEXEC on all open files under Unix. Ticket #2475. (CVS 4146)
authordrh <drh@noemail.net>
Fri, 29 Jun 2007 12:04:26 +0000 (12:04 +0000)
committerdrh <drh@noemail.net>
Fri, 29 Jun 2007 12:04:26 +0000 (12:04 +0000)
FossilOrigin-Name: f1e5fed8eb0fb92bd0f040666c017850afe3cf9f

manifest
manifest.uuid
src/os_unix.c

index 6c7e6c09f9f061006c0167c74b692438776a9300..88a5f9e0a02a3c7f189c6698e8ab767987ffdb23 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\stest\scase\sto\sverify\sthat\sticket\s#2470\shas\sbeen\sfixed.\s(CVS\s4145)
-D 2007-06-27T23:52:18
+C Set\sFD_CLOEXEC\son\sall\sopen\sfiles\sunder\sUnix.\s\sTicket\s#2475.\s(CVS\s4146)
+D 2007-06-29T12:04:26
 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -93,7 +93,7 @@ F src/os_os2.c 2ce97909b926a598823f97338027dbec1dcf4165
 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c 113ae3557500a0a04f78b02bb1290262ede6bbf8
+F src/os_unix.c 4099d05dc4b01997e80a289f3c6a220688e5cff5
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c d868d5f9e95ec9c1b9e2a30c54c996053db6dddd
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 57840eba6a4380a0b71dc9514cdda41e2c455bb0
-R d0d6e08a4eb10c3e13819067c7061aec
+P b3f442698e01ad55666703025c4457445f2efc9b
+R 32ae689340efe4ebbf465449d4fc6cf6
 U drh
-Z 97914bdcc06bf549188d2ae1e30f9e9f
+Z 1010b88245cb62615c48bcce03c46f90
index bd58a1afa6d75f710ce9bee61470e88e73a77ef3..3682475ce0092268493dcef96d5fbd9c90403647 100644 (file)
@@ -1 +1 @@
-b3f442698e01ad55666703025c4457445f2efc9b
\ No newline at end of file
+f1e5fed8eb0fb92bd0f040666c017850afe3cf9f
\ No newline at end of file
index 0bb9feef072d5d0a44c212c8cc9c628a92f28f25..cc8449f560a79b8078b6b65d8e39dcdc757b01ae 100644 (file)
@@ -918,15 +918,19 @@ static int unixOpenDirectory(
   OsFile *id,
   const char *zDirname
 ){
+  int h;
   unixFile *pFile = (unixFile*)id;
   assert( pFile!=0 );
   SET_THREADID(pFile);
   assert( pFile->dirfd<0 );
-  pFile->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0);
-  if( pFile->dirfd<0 ){
+  pFile->dirfd = h = open(zDirname, O_RDONLY|O_BINARY, 0);
+  if( h<0 ){
     return SQLITE_CANTOPEN; 
   }
-  OSTRACE3("OPENDIR %-3d %s\n", pFile->dirfd, zDirname);
+#ifdef FD_CLOEXEC
+  fcntl(h, F_SETFD, fcntl(h, F_GETFD, 0) | FD_CLOEXEC);
+#endif
+  OSTRACE3("OPENDIR %-3d %s\n", h, zDirname);
   return SQLITE_OK;
 }
 
@@ -2577,6 +2581,9 @@ static int allocateUnixFile(
   unixFile f;
   int rc;
 
+#ifdef FD_CLOEXEC
+  fcntl(h, F_SETFD, fcntl(h, F_GETFD, 0) | FD_CLOEXEC);
+#endif
   memset(&f, 0, sizeof(f));
   sqlite3OsEnterMutex();
   rc = findLockInfo(h, &f.pLock, &f.pOpen);