-#undef I3__FILE__
-#define I3__FILE__ "log.c"
/*
* vim:ts=4:sw=4:expandtab
*
* log.c: Logging functions.
*
*/
+#include <config.h>
+
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
fprintf(stderr, "Could not initialize errorlog\n");
else {
errorfile = fopen(errorfilename, "w");
- if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) {
- fprintf(stderr, "Could not set close-on-exec flag\n");
+ if (!errorfile) {
+ fprintf(stderr, "Could not initialize errorlog on %s: %s\n",
+ errorfilename, strerror(errno));
+ } else {
+ if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) {
+ fprintf(stderr, "Could not set close-on-exec flag\n");
+ }
}
}
}