]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/misc-progs/syslogdctrl.c
syslogdctrl: Fix sed syntax issues
[people/pmueller/ipfire-2.x.git] / src / misc-progs / syslogdctrl.c
index 6d7dfacaa2c58b282102e70b6ea361e4323b8543..d73c4226518f3082086f993e0681db410d789597 100644 (file)
@@ -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 */