r12912: patch from Tony Mountifield <tony@softins.co.uk> for BUG 3327 (fix bad access...
authorGerald Carter <jerry@samba.org>
Fri, 13 Jan 2006 18:45:30 +0000 (18:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:06:06 +0000 (11:06 -0500)
(This used to be commit 68399ce04ca4509d51950d2d7b1ed817e82bf17c)

source3/client/smbmount.c
source3/lib/gencache.c

index 4438964b83857f29b61d5800135ffb25b7cd3610..d8254ef23a7abbb47ac7723e55d64ce3a251a12b 100644 (file)
@@ -386,6 +386,9 @@ static void send_fs_socket(char *the_service, char *mount_point, struct cli_stat
                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)
index 85599c92d33725ed35c75a3809a2686006a93548..fd44616270c106eb7ddb304a3a660cd087ad4b02 100644 (file)
@@ -83,10 +83,13 @@ BOOL gencache_init(void)
  
 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;
 }