diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2012-01-28 18:56:29 +0100 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2012-01-28 18:59:16 +0100 |
commit | 2d2751c4331a0204c4f7f6c4dd3994f34e0a4d47 (patch) | |
tree | 18baa2e364b095b0beec6d92bfcb02b8bc2301f4 /src | |
parent | 6be8a0679b8d64ea5b99ea98839eab2ce129988b (diff) |
Do not unlink the temp. log during shutdown
Also ignore errors in case of EROFS (Read-Only file systems)
Reported-by: Maxim Kammerer
X-Gentoo-Bug: 401115
X-Gentoo-Bug-URL: https://bugs.gentoo.org/401115
Diffstat (limited to 'src')
-rw-r--r-- | src/rc/rc-logger.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index c0853159..468225ff 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -280,7 +280,7 @@ rc_logger_open(const char *level) * 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) && (strcmp(level, RC_LEVEL_SYSINIT) != 0)) { + if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) { log_error = 1; eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno)); } @@ -288,8 +288,9 @@ rc_logger_open(const char *level) /* Try to keep the temporary log in case of errors */ if (!log_error) { - if (unlink(TMPLOG) == -1) - eerror("Error: unlink(%s) failed: %s", TMPLOG, strerror(errno)); + if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) + if (unlink(TMPLOG) == -1) + eerror("Error: unlink(%s) failed: %s", TMPLOG, strerror(errno)); } else if (exists(TMPLOG)) eerrorx("Warning: temporary logfile left behind: %s", TMPLOG); |