commit:     3adb8fb389caaafbed1be13c5ac4d96214c8eed3
Author:     Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Sun Jul 24 02:27:53 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jul 24 02:27:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3adb8fb3

rc-logger: refuse to cat TMPLOG into itself

This prevents an infinite loop in case somebody decides to set
rc_log_path to match TMPLOG.

 src/rc/rc-logger.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index 06f3398..b4bd0ea 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -247,6 +247,10 @@ rc_logger_open(const char *level)
                logfile = rc_conf_value("rc_log_path");
                if (logfile == NULL)
                        logfile = DEFAULTLOG;
+               if (!strcmp(logfile, TMPLOG)) {
+                       eerror("Cowardly refusing to concatenate a logfile into 
itself.");
+                       eerrorx("Please change rc_log_path to something other 
than %s to get rid of this message", TMPLOG);
+               }
 
                if ((plog = fopen(logfile, "ae"))) {
                        if ((log = fopen(TMPLOG, "re"))) {

Reply via email to