diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-30 12:42:57 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-10-30 14:14:05 +0100 |
commit | 6d63b6484f0b6411fb3463c17167b814006ab546 (patch) | |
tree | 34737b180165bb96b56d0e28d2c29650a08b8b62 /src/systemd | |
parent | 287d1aee77ccb9b26fe72045fd50dbd428e40a80 (diff) | |
download | NetworkManager-6d63b6484f0b6411fb3463c17167b814006ab546.tar.gz |
systemd: avoid coverity warning about Deadcode
Coverity is unhappy about comparing the literal LOG_DEBUG value:
1. Defect type: CONSTANT_EXPRESSION_RESULT
1. NetworkManager-1.9.2/src/systemd/src/libsystemd/sd-event/sd-event.c:2652:
result_independent_of_operands: "7 >= (_level & 7)" is always true regardless
of the values of its operands. This occurs as the logical first operand of "?:".
Work around by instead using an inline function.
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-adapt/nm-sd-adapt.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/systemd/sd-adapt/nm-sd-adapt.h b/src/systemd/sd-adapt/nm-sd-adapt.h index feb982876b..0d291e26e5 100644 --- a/src/systemd/sd-adapt/nm-sd-adapt.h +++ b/src/systemd/sd-adapt/nm-sd-adapt.h @@ -60,7 +60,13 @@ _slog_level_to_nm (int slevel) } } -#define log_get_max_level_realm(realm) (LOG_DEBUG) +static inline int +_nm_log_get_max_level_realm (void) +{ + /* inline function, to avoid coverity warning about constant expression. */ + return LOG_DEBUG; +} +#define log_get_max_level_realm(realm) _nm_log_get_max_level_realm () #define log_internal_realm(level, error, file, line, func, format, ...) \ ({ \ |