]> jfr.im git - irc/quakenet/newserv.git/commitdiff
display warning if log file can't be opened to stderr
authorPaul <redacted>
Wed, 4 Feb 2009 23:17:13 +0000 (23:17 +0000)
committerPaul <redacted>
Wed, 4 Feb 2009 23:17:13 +0000 (23:17 +0000)
--HG--
branch : paul

core/error.c

index edd986990bb5e7056f329c07c9c3fa5a3a403e1c..3200ee3eabda1b8b5d149f1170ad45ab7b8977db 100644 (file)
@@ -45,12 +45,16 @@ void reopen_logfile(int hooknum, void *arg) {
 
 void init_logfile() {
   logfile=fopen("logs/newserv.log","a");
+  if (!logfile) {
+    fprintf(stderr,"Failed to open logfile...\n");
+  }
   registerhook(HOOK_CORE_SIGUSR1, reopen_logfile);
 }
 
 void fini_logfile() {
   deregisterhook(HOOK_CORE_SIGUSR1, reopen_logfile);
-  fclose(logfile);
+  if (logfile)
+    fclose(logfile);
 }
 
 void Error(char *source, int severity, char *reason, ... ) {