diff options
author | Sami Kerola <kerolasa@iki.fi> | 2018-10-25 21:35:10 +0100 |
---|---|---|
committer | Sami Kerola <kerolasa@iki.fi> | 2018-10-25 21:35:10 +0100 |
commit | 8e5d8eb2bef95646fe5d1ca9894582fdde4c6bcc (patch) | |
tree | 74bb0d694b3437ea572c380b6843a0f220f0b69d | |
parent | d52fa39545bfa8dd6656a5bfc6cf119c1d57381e (diff) | |
download | iputils-8e5d8eb2bef95646fe5d1ca9894582fdde4c6bcc.tar.gz |
ninfod: use build-sys to define if syslog messages are enabled
Despite the fact preprocessor variable name is ENABLE_DEBUG these are
generally useful messages about what failed and how.
In same go fix a warning added in 90d90f40f1f7fa72016e1dbaa5ea18d0dd175dc6.
ninfod/ninfod_core.c:435:6: warning: explicitly assigning value of variable
of type 'int' to itself [-Wself-assign]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | meson_options.txt | 3 | ||||
-rw-r--r-- | ninfod/ninfod.c | 5 | ||||
-rw-r--r-- | ninfod/ninfod.h | 4 | ||||
-rw-r--r-- | ninfod/ninfod_core.c | 9 |
5 files changed, 14 insertions, 11 deletions
diff --git a/meson.build b/meson.build index 7065848..da83c0b 100644 --- a/meson.build +++ b/meson.build @@ -160,6 +160,10 @@ if build_ninfod == true conf.set('HAVE_LIBPTHREAD', 1, description : 'Defined if libpthread is found.') endif + opt = get_option('NINFOD_MESSAGES') + if opt == true + conf.set('ENABLE_DEBUG', 1, description : 'Enable ninfod syslog messages.') + endif endif git_version_h = vcs_tag( diff --git a/meson_options.txt b/meson_options.txt index c825156..a14a4d7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -37,6 +37,9 @@ option('BUILD_TRACEROUTE6', type : 'boolean', value : true, option('BUILD_NINFOD', type : 'boolean', value : true, description : 'Build ninfod') +option('NINFOD_MESSAGES', type : 'boolean', value : true, + description : 'Enable ninfod syslog messages') + option('BUILD_MANS', type : 'boolean', value : true, description : 'Build manuals') diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c index c982d1c..2fc7f81 100644 --- a/ninfod/ninfod.c +++ b/ninfod/ninfod.c @@ -166,11 +166,6 @@ void DEBUG(int pri, char *fmt, ...) } errno = saved_errno; } -#else -void DEBUG(int pri __attribute__((__unused__)), - char *fmt __attribute__((__unused__)), ...) -{ -} #endif /* --------- */ diff --git a/ninfod/ninfod.h b/ninfod/ninfod.h index 8468661..ffa692c 100644 --- a/ninfod/ninfod.h +++ b/ninfod/ninfod.h @@ -32,10 +32,6 @@ * YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> */ -#if 1 -# define ENABLE_DEBUG 1 -#endif - /* definitions */ #define NINFOD "ninfod" #define NINFOD_PIDFILE "/var/run/ninfod.pid" diff --git a/ninfod/ninfod_core.c b/ninfod/ninfod_core.c index 6aa36a5..c618dba 100644 --- a/ninfod/ninfod_core.c +++ b/ninfod/ninfod_core.c @@ -428,11 +428,16 @@ void init_core(int forced) #if ENABLE_THREADS && HAVE_LIBPTHREAD static void *ni_send_thread(void *data) { +#if ENABLE_DEBUG int ret; + DEBUG(LOG_DEBUG, "%s(): thread=%ld\n", __func__, pthread_self()); - ret = ni_send(data); + ret = +#endif + ni_send(data); +#if ENABLE_DEBUG DEBUG(LOG_DEBUG, "%s(): thread=%ld => %d\n", __func__, pthread_self(), ret); - ret = ret; +#endif return NULL; } #else |