From: Christian Schmidt Date: Wed, 12 May 2010 20:08:15 +0000 (+0200) Subject: Fixed async logging feature. X-Git-Tag: v2.9-beta1~316 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=77e9b64c80dc0821227ba59d483baec52a0d4aeb Fixed async logging feature. --- diff --git a/src/misc-progs/syslogdctrl.c b/src/misc-progs/syslogdctrl.c index a470e47edb..993cc938d9 100644 --- a/src/misc-progs/syslogdctrl.c +++ b/src/misc-progs/syslogdctrl.c @@ -31,13 +31,14 @@ int main(void) { char buffer[STRING_SIZE], command[STRING_SIZE], hostname[STRING_SIZE]; - char varmessages[STRING_SIZE], enable_asynclog[STRING_SIZE]; + char varmessages[STRING_SIZE], asynclog[STRING_SIZE]; int config_fd,rc,fd,pid; struct stat st; struct keyvalue *kv = NULL; memset(buffer, 0, STRING_SIZE); memset(hostname, 0, STRING_SIZE); memset(varmessages, 0, STRING_SIZE); + memset(asynclog, 0, STRING_SIZE); if (!(initsetuid())) exit(1); @@ -64,7 +65,7 @@ int main(void) exit(ERR_SETTINGS); } - if (!findkey(kv, "ENABLE_ASYNCLOG", enable_asynclog)) + if (!findkey(kv, "ENABLE_ASYNCLOG", asynclog)) { fprintf(stderr, "Cannot read ENABLE_ASYNCLOG\n"); exit(ERR_SETTINGS); @@ -133,10 +134,10 @@ int main(void) /* Replace the logging option*/ safe_system("grep -v '/var/log/messages' < /etc/syslog.conf.new > /etc/syslog.conf.tmp && mv /etc/syslog.conf.tmp /etc/syslog.conf.new"); - if (strcmp(enable_asynclog,"on")) - snprintf(command, STRING_SIZE-1, "printf '%s -/var/log/messages' >> /etc/syslog.conf.new", varmessages ); + if (!strcmp(asynclog,"on")) + snprintf(command, STRING_SIZE - 1, "printf '%s -/var/log/messages' >> /etc/syslog.conf.new", varmessages ); else - snprintf(command, STRING_SIZE-1, "printf '%s /var/log/messages' >> /etc/syslog.conf.new", varmessages ); + snprintf(command, STRING_SIZE - 1, "printf '%s /var/log/messages' >> /etc/syslog.conf.new", varmessages ); safe_system(command);