changeset 1210:64a50eac1030

Moved usingsyslog from svr_runopts to runopts.
author Konstantin Tokarev <ktokarev@smartlabs.tv>
date Tue, 01 Dec 2015 21:52:38 +0300
parents ab7d9c12caa7
children 6ecc133fb2ee
files cli-runopts.c runopts.h svr-main.c svr-runopts.c svr-session.c
diffstat 5 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cli-runopts.c	Tue Dec 15 21:40:32 2015 +0800
+++ b/cli-runopts.c	Tue Dec 01 21:52:38 2015 +0300
@@ -173,6 +173,9 @@
 	opts.cipher_list = NULL;
 	opts.mac_list = NULL;
 #endif
+#ifndef DISABLE_SYSLOG
+	opts.usingsyslog = 0;
+#endif
 	/* not yet
 	opts.ipv4 = 1;
 	opts.ipv6 = 1;
--- a/runopts.h	Tue Dec 15 21:40:32 2015 +0800
+++ b/runopts.h	Tue Dec 01 21:52:38 2015 +0300
@@ -40,6 +40,7 @@
 	unsigned int recv_window;
 	time_t keepalive_secs; /* Time between sending keepalives. 0 is off */
 	time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */
+	int usingsyslog;
 
 #ifndef DISABLE_ZLIB
 	/* TODO: add a commandline flag. Currently this is on by default if compression
@@ -70,7 +71,6 @@
 	char * bannerfile;
 
 	int forkbg;
-	int usingsyslog;
 
 	/* ports and addresses are arrays of the portcount 
 	listening ports. strings are malloced. */
--- a/svr-main.c	Tue Dec 15 21:40:32 2015 +0800
+++ b/svr-main.c	Tue Dec 01 21:52:38 2015 +0300
@@ -145,7 +145,7 @@
 	if (svr_opts.forkbg) {
 		int closefds = 0;
 #ifndef DEBUG_TRACE
-		if (!svr_opts.usingsyslog) {
+		if (!opts.usingsyslog) {
 			closefds = 1;
 		}
 #endif
@@ -367,8 +367,8 @@
 
 	struct sigaction sa_chld;
 #ifndef DISABLE_SYSLOG
-	if (svr_opts.usingsyslog) {
 		startsyslog();
+	if (opts.usingsyslog) {
 	}
 #endif
 
--- a/svr-runopts.c	Tue Dec 15 21:40:32 2015 +0800
+++ b/svr-runopts.c	Tue Dec 01 21:52:38 2015 +0300
@@ -158,7 +158,7 @@
 	svr_opts.domotd = 1;
 #endif
 #ifndef DISABLE_SYSLOG
-	svr_opts.usingsyslog = 1;
+	opts.usingsyslog = 1;
 #endif
 	opts.recv_window = DEFAULT_RECV_WINDOW;
 	opts.keepalive_secs = DEFAULT_KEEPALIVE;
@@ -189,7 +189,7 @@
 					break;
 #ifndef DISABLE_SYSLOG
 				case 'E':
-					svr_opts.usingsyslog = 0;
+					opts.usingsyslog = 0;
 					break;
 #endif
 #ifdef ENABLE_SVR_LOCALTCPFWD
--- a/svr-session.c	Tue Dec 15 21:40:32 2015 +0800
+++ b/svr-session.c	Tue Dec 01 21:52:38 2015 +0300
@@ -204,7 +204,7 @@
 	vsnprintf(printbuf, sizeof(printbuf), format, param);
 
 #ifndef DISABLE_SYSLOG
-	if (svr_opts.usingsyslog) {
+	if (opts.usingsyslog) {
 		syslog(priority, "%s", printbuf);
 	}
 #endif
@@ -215,7 +215,7 @@
 	havetrace = debug_trace;
 #endif
 
-	if (!svr_opts.usingsyslog || havetrace)
+	if (!opts.usingsyslog || havetrace)
 	{
 		struct tm * local_tm = NULL;
 		timesec = time(NULL);