Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
Date: Mon, 25 Jul 2016 18:54:44
Message-Id: 1469327273.3adb8fb389caaafbed1be13c5ac4d96214c8eed3.williamh@OpenRC
1 commit: 3adb8fb389caaafbed1be13c5ac4d96214c8eed3
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 24 02:27:53 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3adb8fb3
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"))) {