summaryrefslogtreecommitdiff
path: root/sysdep/unix/log.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-08 17:03:31 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-08 17:04:29 +0100
commitcc5b93f72db80abd1262a0a5e1d8400ceef54385 (patch)
tree42d75cb7898c6b6077e9cfbb04074cfc84e38930 /sysdep/unix/log.c
parent5de0e848de06a9187046dbc380d9ce6a6f8b21a2 (diff)
parentf51b1f556595108d53b9f4580bfcb96bfbc85442 (diff)
Merge tag 'v1.6.2' into int-new
Diffstat (limited to 'sysdep/unix/log.c')
-rw-r--r--sysdep/unix/log.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index 9c56eb24..e5c5e74e 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
+#include <errno.h>
#include "nest/bird.h"
#include "nest/cli.h"
@@ -209,6 +210,7 @@ bug(const char *msg, ...)
va_start(args, msg);
vlog(L_BUG[0], msg, args);
+ va_end(args);
abort();
}
@@ -226,6 +228,7 @@ die(const char *msg, ...)
va_start(args, msg);
vlog(L_FATAL[0], msg, args);
+ va_end(args);
exit(1);
}
@@ -312,7 +315,11 @@ log_init_debug(char *f)
else if (!*f)
dbgf = stderr;
else if (!(dbgf = fopen(f, "a")))
- log(L_ERR "Error opening debug file `%s': %m", f);
+ {
+ /* Cannot use die() nor log() here, logging is not yet initialized */
+ fprintf(stderr, "bird: Unable to open debug file %s: %s\n", f, strerror(errno));
+ exit(1);
+ }
if (dbgf)
setvbuf(dbgf, NULL, _IONBF, 0);
}