Don't try to write the log during sysinit

During the sysinit and shutdown runlevels the logfile destination may be
read-only. Skip the error messages in this case.

X-Gentoo-Bug: 390645
X-Gentoo-Bug-URL: https://bugs.gentoo.org/390645
This commit is contained in:
Christian Ruppert 2011-12-29 13:55:47 +01:00
parent 8dcb7554ee
commit 49e99a7393

View File

@ -277,10 +277,10 @@ rc_logger_open(const char *level)
fclose(plog);
} else {
/*
* logfile or its basedir may be read-only during shutdown so skip
* the error in this case
* logfile or its basedir may be read-only during sysinit and
* shutdown so skip the error in this case
*/
if (strcmp(level, RC_LEVEL_SHUTDOWN) != 0) {
if ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0)) {
log_error = 1;
eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno));
}