]> code.citadel.org Git - citadel.git/blobdiff - citadel/logging.c
* Changed the comments at the beginning of each file to a consistent format
[citadel.git] / citadel / logging.c
index a9022876557211d92559bad7c81b17e1b71ecb36..af9b5703124ad9d918e514955b655a9091e3dbba 100644 (file)
@@ -1,6 +1,8 @@
 /*
- * Everything which needs some logging...
  * $Id$
+ *
+ * Everything which needs some logging...
+ *
  */
 
 #include "sysdep.h"
@@ -13,9 +15,6 @@
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
 #include <syslog.h>
 #include "citadel.h"
 #include "server.h"
@@ -28,6 +27,8 @@ void rec_log(unsigned int lrtype, char *name) {
 
        time(&now);
        fp = fopen("citadel.log", "a");
-       fprintf(fp, "%ld|%u|%s\n", now, lrtype, name);
-       fclose(fp);
+       if (fp != NULL) {
+               fprintf(fp, "%ld|%u|%s\n", (long)now, lrtype, name);
+               fclose(fp);
        }
+}