From: Michael Tremer Date: Tue, 30 Jan 2018 20:54:46 +0000 (+0000) Subject: syslogdctrl: Fix sed syntax issues X-Git-Tag: v2.19-core118^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3925a0db6cc0ca91fe34eb7c0366f72b0af39ab6;p=people%2Fstevee%2Fipfire-2.x.git syslogdctrl: Fix sed syntax issues Signed-off-by: Michael Tremer --- diff --git a/src/misc-progs/syslogdctrl.c b/src/misc-progs/syslogdctrl.c index 6d7dfacaa2..d73c422651 100644 --- a/src/misc-progs/syslogdctrl.c +++ b/src/misc-progs/syslogdctrl.c @@ -118,18 +118,18 @@ int main(void) if (strcmp(protocol, "tcp") == 0) { /* write line for TCP */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, config_fd ); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@@%s/' /etc/syslog.conf >&%d", hostname, config_fd); } else { /* write line for UDP */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, config_fd ); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@%s/' /etc/syslog.conf >&%d", hostname, config_fd); } } else { /* if remote syslog has been disabled */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd ); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@@\\?.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd ); } /* if the return code isn't 0 failsafe */