From: Jens-Wolfhard Schicke-Uffmann Date: Tue, 10 Jan 2017 08:29:06 +0000 (+0100) Subject: Report error during error log creation (#2625) X-Git-Tag: 4.14~76 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=584263b1b3393015d7c77a63e21bd5c50583e5ce;p=i3%2Fi3 Report error during error log creation (#2625) --- diff --git a/src/log.c b/src/log.c index 1c33649a..916085f4 100644 --- a/src/log.c +++ b/src/log.c @@ -88,8 +88,13 @@ void init_logging(void) { 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"); + } } } }