1 |
commit: 2d2751c4331a0204c4f7f6c4dd3994f34e0a4d47 |
2 |
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 28 17:56:29 2012 +0000 |
4 |
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 28 17:59:16 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=2d2751c4 |
7 |
|
8 |
Do not unlink the temp. log during shutdown |
9 |
|
10 |
Also ignore errors in case of EROFS (Read-Only file systems) |
11 |
Reported-by: Maxim Kammerer |
12 |
X-Gentoo-Bug: 401115 |
13 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/401115 |
14 |
|
15 |
--- |
16 |
src/rc/rc-logger.c | 7 ++++--- |
17 |
1 files changed, 4 insertions(+), 3 deletions(-) |
18 |
|
19 |
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c |
20 |
index c085315..468225f 100644 |
21 |
--- a/src/rc/rc-logger.c |
22 |
+++ b/src/rc/rc-logger.c |
23 |
@@ -280,7 +280,7 @@ rc_logger_open(const char *level) |
24 |
* logfile or its basedir may be read-only during sysinit and |
25 |
* shutdown so skip the error in this case |
26 |
*/ |
27 |
- if ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0)) { |
28 |
+ if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) { |
29 |
log_error = 1; |
30 |
eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno)); |
31 |
} |
32 |
@@ -288,8 +288,9 @@ rc_logger_open(const char *level) |
33 |
|
34 |
/* Try to keep the temporary log in case of errors */ |
35 |
if (!log_error) { |
36 |
- if (unlink(TMPLOG) == -1) |
37 |
- eerror("Error: unlink(%s) failed: %s", TMPLOG, strerror(errno)); |
38 |
+ if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) |
39 |
+ if (unlink(TMPLOG) == -1) |
40 |
+ eerror("Error: unlink(%s) failed: %s", TMPLOG, strerror(errno)); |
41 |
} else if (exists(TMPLOG)) |
42 |
eerrorx("Warning: temporary logfile left behind: %s", TMPLOG); |