From 910267cf5f0f163a038ec983bec237c8a8cb1abf Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 18 Feb 2020 17:04:37 +0100 Subject: [PATCH] n-dhcp4: fix logging macro The level can be a complex expression, don't use it directly in the macro. --- shared/n-dhcp4/src/n-dhcp4-private.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/n-dhcp4/src/n-dhcp4-private.h b/shared/n-dhcp4/src/n-dhcp4-private.h index 436ee8065c..f647cb5e2b 100644 --- a/shared/n-dhcp4/src/n-dhcp4-private.h +++ b/shared/n-dhcp4/src/n-dhcp4-private.h @@ -702,10 +702,11 @@ static inline uint64_t n_dhcp4_gettime(clockid_t clock) { #define n_dhcp4_c_log(_config, _level, ...) \ do { \ const NDhcp4ClientConfig *__config = _config; \ + int __level = _level; \ \ - if (_level <= __config->log.level && __config->log.func) { \ + if (__level <= __config->log.level && __config->log.func) { \ if (1) { \ - _config->log.func(_level, \ + _config->log.func(__level, \ __config->log.data, \ __VA_ARGS__); \ } else { \