db.c
changeset 16 e6a640ad2cc2
parent 15 2706fc514dea
child 17 bd746609ba46
--- a/db.c	Sat Nov 05 12:52:29 2011 -0700
+++ b/db.c	Mon Nov 07 10:43:06 2011 -0800
@@ -88,7 +88,7 @@
 
 	/* open temporary file */
 	debug( 0, LOC, "Creating/updating database (%s) using rules in \"%s\"\n", v.dbname, txt );
-	sprintf( tmpfile, "/tmp/volta-db-%d.tmp", getpid() );
+	sprintf( tmpfile, "volta-db-%d.tmp", getpid() );
 	if ( (tmp_fd = open( tmpfile,
 						 O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH )) == -1 ) {
 		debug( 0, LOC, "Error writing temporary file: %s\n", strerror(errno) );
@@ -131,7 +131,7 @@
 
 	/* move cdb into place */
 	if ( (rename( tmpfile, v.dbname )) == -1 ) {
-		debug( 1, LOC, "Unable to move temp cdb into place: %s", strerror(errno) );
+		debug( 0, LOC, "Unable to move temp cdb into place: %s", strerror(errno) );
 		return( 1 );
 	}
 
@@ -182,7 +182,7 @@
 		free( val );
 		if ( rule != NULL ) {
 			if ( check_rule( rule, p_request ) == 0 ) {
-				finish_parsed( rule );
+				finish_parsed( rule ), rule = NULL;
 			}
 			else {
 				break;