rc-logger.c: fix crash on fclose(NULL) (#137)

Only close the log if we successfully opened it.

Reported-by: Brian Evans <grknight@gentoo.org>
Tested-by: Brian Evans <grknight@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This commit is contained in:
Sergei Trofimovich 2017-05-30 08:47:55 +01:00 committed by Doug Freed
parent ec27299f4b
commit 7185e242ff

View File

@ -261,12 +261,12 @@ rc_logger_open(const char *level)
break;
}
}
fclose(log);
} else {
log_error = 1;
eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno));
}
fclose(log);
fclose(plog);
} else {
/*