[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] rewrite close_logs so it could possibly work



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common

Modified Files:
	log.c util.c 
Log Message:
rewrite close_logs so it could possibly work
remove deadbeef memory-clobber testing (for now)


Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- log.c	15 Oct 2003 18:50:09 -0000	1.26
+++ log.c	18 Oct 2003 00:07:58 -0000	1.27
@@ -116,14 +116,14 @@
 
 void close_logs()
 {
-  logfile_t *next, *lf;
-  for (lf = logfiles; lf; lf = lf->next) {
-    if (lf->needs_close)
-      fclose(lf->file);
-    next = lf->next;
-    free(lf);
+  logfile_t *victim;
+  while(logfiles) {
+    victim = logfiles;
+    logfiles = logfiles->next;
+    if (victim->needs_close)
+      fclose(victim->file);
+    free(victim);
   }
-  logfiles = NULL;
 }
 
 void reset_logs()

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- util.c	15 Oct 2003 18:48:48 -0000	1.30
+++ util.c	18 Oct 2003 00:07:58 -0000	1.31
@@ -21,7 +21,7 @@
     log_fn(LOG_ERR, "Out of memory. Dying.");
     exit(1);
   }
-  memset(result,'X',size); /* XXX deadbeef to encourage bugs */
+//  memset(result,'X',size); /* deadbeef to encourage bugs */
   return result;
 }