Revision: 5295 http://ipcop.svn.sourceforge.net/ipcop/?rev=5295&view=rev Author: owes Date: 2011-01-04 09:32:28 +0000 (Tue, 04 Jan 2011)
Log Message: ----------- Fix use of remote_log variable. Add some verbose logging. Modified Paths: -------------- ipcop/trunk/src/misc-progs/restartsyslogd.c Modified: ipcop/trunk/src/misc-progs/restartsyslogd.c =================================================================== --- ipcop/trunk/src/misc-progs/restartsyslogd.c 2011-01-03 17:03:54 UTC (rev 5294) +++ ipcop/trunk/src/misc-progs/restartsyslogd.c 2011-01-04 09:32:28 UTC (rev 5295) @@ -54,10 +54,11 @@ int main(int argc, char **argv) { - char buffer[STRING_SIZE], hostname[STRING_SIZE]; + char buffer[STRING_SIZE]; int config_fd; int rc; int remote_log; + char hostname[STRING_SIZE]; struct stat st; NODEKV *log_kv = NULL; @@ -95,10 +96,8 @@ exit(ERR_SETTINGS); } - if (find_kv_default(log_kv, "ENABLE_REMOTELOG", buffer) != SUCCESS) { - fprintf(stderr, "Cannot read ENABLE_REMOTELOG\n"); - exit(ERR_SETTINGS); - } + remote_log = (test_kv(log_kv, "ENABLE_REMOTELOG", "on") == SUCCESS); + verbose_printf(2, " remotelog: %s\n", remote_log ? "on" : "off"); if (find_kv_default(log_kv, "REMOTELOG_ADDR", hostname) != SUCCESS) { fprintf(stderr, "Cannot read REMOTELOG_ADDR\n"); @@ -109,9 +108,10 @@ fprintf(stderr, "Bad REMOTELOG_ADDR: %s\n", hostname); exit(ERR_SETTINGS); } + if (remote_log) { + verbose_printf(2, " remotelog addr: %s\n", hostname); + } - remote_log = test_kv(log_kv, "ENABLE_REMOTELOG", "on"); - free_kv(&log_kv); @@ -141,13 +141,15 @@ exit(ERR_CONFIG); } - if (!strcmp(buffer, "on")) + if (remote_log) { snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]...@\\).\\+$/\\1%s/' /etc/rsyslog.conf >&%d", hostname, config_fd); - else + } + else { snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]...@.\\+\\)$/#\\1/' /etc/rsyslog.conf >&%d", config_fd); + } /* if the return code isn't 0 failsafe */ if ((rc = unpriv_system(buffer, 99, 99)) != 0) { @@ -164,7 +166,7 @@ } if (access("/var/run/rsyslogd.pid", 0) != -1) { - verbose_printf(1, "Stopping syslogd ... \n"); + verbose_printf(1, "Stopping rsyslogd ... \n"); mysignalpidfile("/var/run/rsyslogd.pid", SIGTERM); unlink("/var/run/rsyslogd.pid"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn