X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Flog.c;h=916085f456a8d8c1a95dbfca8c13d3d5b038db12;hb=dc16df439e8866ba49b69304412757c07d5807e5;hp=1c33649a52d176283999a324e0c1ee6a5ef165c0;hpb=f58dde28504cd78267439ec232be9689ff82d47c;p=i3%2Fi3 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"); + } } } }