svn commit: samba r19530 - in branches: SAMBA_3_0_23/source/lib SAMBA_3_0_24/source/lib

jra at samba.org jra at samba.org
Wed Nov 1 18:48:40 GMT 2006


Author: jra
Date: 2006-11-01 18:48:39 +0000 (Wed, 01 Nov 2006)
New Revision: 19530

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

Log:
Fix opening gencache from non-root.
Jeremy.

Modified:
   branches/SAMBA_3_0_23/source/lib/gencache.c
   branches/SAMBA_3_0_24/source/lib/gencache.c


Changeset:
Modified: branches/SAMBA_3_0_23/source/lib/gencache.c
===================================================================
--- branches/SAMBA_3_0_23/source/lib/gencache.c	2006-11-01 17:18:08 UTC (rev 19529)
+++ branches/SAMBA_3_0_23/source/lib/gencache.c	2006-11-01 18:48:39 UTC (rev 19530)
@@ -56,14 +56,10 @@
 	/* skip file open if it's already opened */
 	if (cache) return True;
 
-	asprintf(&cache_fname, "%s/%s", lp_lockdir(), "gencache.tdb");
-	if (cache_fname)
-		DEBUG(5, ("Opening cache file at %s\n", cache_fname));
-	else {
-		DEBUG(0, ("Filename allocation failed.\n"));
-		return False;
-	}
+	cache_fname = lock_path("gencache.tdb");
 
+	DEBUG(5, ("Opening cache file at %s\n", cache_fname));
+
 	cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT,
 	                     O_RDWR|O_CREAT, 0644);
 
@@ -75,7 +71,6 @@
 		}
 	}
 
-	SAFE_FREE(cache_fname);
 	if (!cache) {
 		DEBUG(5, ("Attempt to open gencache.tdb has failed.\n"));
 		return False;

Modified: branches/SAMBA_3_0_24/source/lib/gencache.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/gencache.c	2006-11-01 17:18:08 UTC (rev 19529)
+++ branches/SAMBA_3_0_24/source/lib/gencache.c	2006-11-01 18:48:39 UTC (rev 19530)
@@ -56,14 +56,10 @@
 	/* skip file open if it's already opened */
 	if (cache) return True;
 
-	asprintf(&cache_fname, "%s/%s", lp_lockdir(), "gencache.tdb");
-	if (cache_fname)
-		DEBUG(5, ("Opening cache file at %s\n", cache_fname));
-	else {
-		DEBUG(0, ("Filename allocation failed.\n"));
-		return False;
-	}
+	cache_fname = lock_path("gencache.tdb");
 
+	DEBUG(5, ("Opening cache file at %s\n", cache_fname));
+
 	cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT,
 	                     O_RDWR|O_CREAT, 0644);
 
@@ -75,7 +71,6 @@
 		}
 	}
 
-	SAFE_FREE(cache_fname);
 	if (!cache) {
 		DEBUG(5, ("Attempt to open gencache.tdb has failed.\n"));
 		return False;



More information about the samba-cvs mailing list