1 |
commit: fa39271d7a979ec8c1cf9c694d256456528baaf8 |
2 |
Author: Doug Freed <dwfreed <AT> mtu <DOT> edu> |
3 |
AuthorDate: Sun Jul 24 02:27:53 2016 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 31 18:50:05 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fa39271d |
7 |
|
8 |
rc-logger: refuse to cat TMPLOG into itself |
9 |
|
10 |
This prevents an infinite loop in case somebody decides to set |
11 |
rc_log_path to match TMPLOG. |
12 |
|
13 |
src/rc/rc-logger.c | 4 ++++ |
14 |
1 file changed, 4 insertions(+) |
15 |
|
16 |
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c |
17 |
index 06f3398..b4bd0ea 100644 |
18 |
--- a/src/rc/rc-logger.c |
19 |
+++ b/src/rc/rc-logger.c |
20 |
@@ -247,6 +247,10 @@ rc_logger_open(const char *level) |
21 |
logfile = rc_conf_value("rc_log_path"); |
22 |
if (logfile == NULL) |
23 |
logfile = DEFAULTLOG; |
24 |
+ if (!strcmp(logfile, TMPLOG)) { |
25 |
+ eerror("Cowardly refusing to concatenate a logfile into itself."); |
26 |
+ eerrorx("Please change rc_log_path to something other than %s to get rid of this message", TMPLOG); |
27 |
+ } |
28 |
|
29 |
if ((plog = fopen(logfile, "ae"))) { |
30 |
if ((log = fopen(TMPLOG, "re"))) { |