Don't print error when the logfile isn't writeable during shutdown

The logfile or its basedir may be read-only during shutdown because the
directory may be umounted or read-only remounted already. In this case we simply
skip this error.
This is related to a comment in bug 390645 but the initial bug is not fixed
through this commit.

X-Gentoo-Bug: 390645
X-Gentoo-Bug-URL: https://bugs.gentoo.org/390645
This commit is contained in:
Christian Ruppert 2011-12-29 02:45:04 +01:00
parent b12cb2f507
commit ec65f181ea

View File

@ -276,8 +276,14 @@ rc_logger_open(const char *level)
fclose(log);
fclose(plog);
} else {
log_error = 1;
eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno));
/*
* logfile or its basedir may be read-only during shutdown so skip
* the error in this case
*/
if (strcmp(rc_runlevel_get(), "shutdown") != 0) {
log_error = 1;
eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno));
}
}
/* Try to keep the temporary log in case of errors */