svn commit: samba r12912 - branches/SAMBA_3_0/source/client branches/SAMBA_3_0/source/lib trunk/source/client trunk/source/lib

jerry at samba.org jerry at samba.org
Fri Jan 13 18:45:31 GMT 2006


Author: jerry
Date: 2006-01-13 18:45:30 +0000 (Fri, 13 Jan 2006)
New Revision: 12912

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12912

Log:
patch from Tony Mountifield <tony at softins.co.uk> for BUG 3327 (fix bad access to gencache.tdb after fork() in smbmount
Modified:
   branches/SAMBA_3_0/source/client/smbmount.c
   branches/SAMBA_3_0/source/lib/gencache.c
   trunk/source/client/smbmount.c
   trunk/source/lib/gencache.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/smbmount.c
===================================================================
--- branches/SAMBA_3_0/source/client/smbmount.c	2006-01-13 17:32:43 UTC (rev 12911)
+++ branches/SAMBA_3_0/source/client/smbmount.c	2006-01-13 18:45:30 UTC (rev 12912)
@@ -386,6 +386,9 @@
 		c = NULL;
 
 		if (!closed) {
+			/* close the name cache so that close_our_files() doesn't steal its FD */
+			namecache_shutdown();
+
 			/* redirect stdout & stderr since we can't know that
 			   the library functions we use are using DEBUG. */
 			if ( (fd = open("/dev/null", O_WRONLY)) < 0)

Modified: branches/SAMBA_3_0/source/lib/gencache.c
===================================================================
--- branches/SAMBA_3_0/source/lib/gencache.c	2006-01-13 17:32:43 UTC (rev 12911)
+++ branches/SAMBA_3_0/source/lib/gencache.c	2006-01-13 18:45:30 UTC (rev 12912)
@@ -83,10 +83,13 @@
  
 BOOL gencache_shutdown(void)
 {
+	int ret;
 	/* tdb_close routine returns -1 on error */
 	if (!cache) return False;
 	DEBUG(5, ("Closing cache file\n"));
-	return tdb_close(cache) != -1;
+	ret = tdb_close(cache);
+	cache = NULL;
+	return ret != -1;
 }
 
 

Modified: trunk/source/client/smbmount.c
===================================================================
--- trunk/source/client/smbmount.c	2006-01-13 17:32:43 UTC (rev 12911)
+++ trunk/source/client/smbmount.c	2006-01-13 18:45:30 UTC (rev 12912)
@@ -386,6 +386,9 @@
 		c = NULL;
 
 		if (!closed) {
+			/* close the name cache so that close_our_files() doesn't steal its FD */
+			namecache_shutdown();
+
 			/* redirect stdout & stderr since we can't know that
 			   the library functions we use are using DEBUG. */
 			if ( (fd = open("/dev/null", O_WRONLY)) < 0)

Modified: trunk/source/lib/gencache.c
===================================================================
--- trunk/source/lib/gencache.c	2006-01-13 17:32:43 UTC (rev 12911)
+++ trunk/source/lib/gencache.c	2006-01-13 18:45:30 UTC (rev 12912)
@@ -83,10 +83,13 @@
  
 BOOL gencache_shutdown(void)
 {
+	int ret;
 	/* tdb_close routine returns -1 on error */
 	if (!cache) return False;
 	DEBUG(5, ("Closing cache file\n"));
-	return tdb_close(cache) != -1;
+	ret = tdb_close(cache);
+	cache = NULL;
+	return ret != -1;
 }
 
 



More information about the samba-cvs mailing list