diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2011-12-29 02:45:04 +0100 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2011-12-29 02:50:24 +0100 |
commit | ec65f181eab6289101a0c0df624c9b022f3742d0 (patch) | |
tree | 8cb88b0fe0d302c7c28b0fb310562f1790d0684d | |
parent | b12cb2f507b8ba7acc64e0e8172eb26bae00dc0a (diff) |
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
-rw-r--r-- | src/rc/rc-logger.c | 10 |
1 files changed, 8 insertions, 2 deletions
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 */ |