Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Report error during error log creation (#2625)
Browse files Browse the repository at this point in the history
  • Loading branch information
Drahflow authored and stapelberg committed Jan 10, 2017
1 parent 6da187b commit 584263b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/log.c
Expand Up @@ -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");
}
}
}
}
Expand Down

0 comments on commit 584263b

Please sign in to comment.