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.
This commit is contained in:
parent
8927a37fb7
commit
3adb8fb389
@ -247,6 +247,10 @@ rc_logger_open(const char *level)
|
|||||||
logfile = rc_conf_value("rc_log_path");
|
logfile = rc_conf_value("rc_log_path");
|
||||||
if (logfile == NULL)
|
if (logfile == NULL)
|
||||||
logfile = DEFAULTLOG;
|
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 ((plog = fopen(logfile, "ae"))) {
|
||||||
if ((log = fopen(TMPLOG, "re"))) {
|
if ((log = fopen(TMPLOG, "re"))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user