- remove unused log flags in agent
- set no default log flag for syslog cases
- new snmp_stderrlog_status() checks for enabled stderr log handlers
- fix re-enable of syslog in logging restart function
- use correct function name to re-enabe file logs
- C++ comments -> C comments
git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/trunk@12378 06827809-a52a-0410-b366-d66718629ded
diff --git a/agent/snmpd.c b/agent/snmpd.c
index 81d6802..7356560 100644
--- a/agent/snmpd.c
+++ b/agent/snmpd.c
@@ -573,7 +573,7 @@
argv[0], PATH_MAX);
exit(1);
}
- snmp_enable_filelog(optarg, dont_zero);
+ snmp_enable_filelog(optarg, dont_zero_log);
log_set = 1;
} else {
usage(argv[0]);
@@ -624,7 +624,8 @@
case 's':
printf("Warning: -s option is deprecated, use -Lsd instead\n");
- syslog_log = 1;
+ snmp_enable_syslog();
+ log_set = 1;
break;
case 'S':
@@ -667,6 +668,8 @@
fprintf(stderr, "invalid syslog facility: -S%c\n",*optarg);
usage(argv[0]);
}
+ snmp_enable_syslog_ident(snmp_log_syslogname(NULL), Facility);
+ log_set = 1;
} else {
fprintf(stderr, "no syslog facility specified\n");
usage(argv[0]);
@@ -775,7 +778,7 @@
#ifdef LOGFILE
if (0 == log_set)
- snmp_enable_filelog(LOGFILE, dont_zero);
+ snmp_enable_filelog(LOGFILE, dont_zero_log);
#endif
/*
@@ -823,7 +826,7 @@
if(!dont_fork) {
int quit = ! netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_QUIT_IMMEDIATELY);
- ret = netsnmp_daemonize(quit, stderr_log);
+ ret = netsnmp_daemonize(quit, snmp_stderrlog_status());
/*
* xxx-rks: do we care if fork fails? I think we should...
*/