]> git.sur5r.net Git - i3/i3/commitdiff
Report error during error log creation (#2625)
authorJens-Wolfhard Schicke-Uffmann <drahflow@gmx.de>
Tue, 10 Jan 2017 08:29:06 +0000 (09:29 +0100)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Tue, 10 Jan 2017 08:29:06 +0000 (09:29 +0100)
src/log.c

index 1c33649a52d176283999a324e0c1ee6a5ef165c0..916085f456a8d8c1a95dbfca8c13d3d5b038db12 100644 (file)
--- 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");
+                }
             }
         }
     }