From ec65f181eab6289101a0c0df624c9b022f3742d0 Mon Sep 17 00:00:00 2001 From: Christian Ruppert Date: Thu, 29 Dec 2011 02:45:04 +0100 Subject: 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 --- src/rc/rc-logger.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index 52c39f0f..8f3b218c 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -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 */ -- cgit v1.2.3