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

[or-cvs] crash when our logs go bad



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

Modified Files:
	log.c 
Log Message:
crash when our logs go bad

nick, can you think of a better response here?


Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- log.c	9 Mar 2004 22:09:12 -0000	1.32
+++ log.c	14 Mar 2004 15:50:00 -0000	1.33
@@ -85,9 +85,13 @@
       format_msg(buf, 10024, severity, funcname, format, ap);
       formatted = 1;
     }
-    fputs(buf, lf->file);
-    fflush(lf->file);
-    /* XXX check for EOF */
+    if(fputs(buf, lf->file) == EOF) { /* error */
+      assert(0); /* XXX */
+    }
+    if(fflush(lf->file) == EOF) { /* error */
+      /* don't log the error! */
+      assert(0); /* XXX fail for now. what's better to do? */
+    }
   }
 }