Report error during error log creation (#2625)

This commit is contained in:
Jens-Wolfhard Schicke-Uffmann 2017-01-10 09:29:06 +01:00 committed by Michael Stapelberg
parent 6da187b27f
commit 584263b1b3
1 changed files with 7 additions and 2 deletions

View File

@ -88,11 +88,16 @@ void init_logging(void) {
fprintf(stderr, "Could not initialize errorlog\n"); fprintf(stderr, "Could not initialize errorlog\n");
else { else {
errorfile = fopen(errorfilename, "w"); errorfile = fopen(errorfilename, "w");
if (!errorfile) {
fprintf(stderr, "Could not initialize errorlog on %s: %s\n",
errorfilename, strerror(errno));
} else {
if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) { if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) {
fprintf(stderr, "Could not set close-on-exec flag\n"); fprintf(stderr, "Could not set close-on-exec flag\n");
} }
} }
} }
}
if (physical_mem_bytes == 0) { if (physical_mem_bytes == 0) {
#if defined(__APPLE__) #if defined(__APPLE__)
int mib[2] = {CTL_HW, HW_MEMSIZE}; int mib[2] = {CTL_HW, HW_MEMSIZE};