From 00d27e5dd74a6c67759def1e958a71aae0650976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 5 Aug 2019 16:36:45 +0200 Subject: shared/exit-status: fix lookup FLAGS_SET() is the wrong operator here, because we want to see if *any* bits are set. Add test. https://github.com/systemd/systemd/pull/12884#issuecomment-518238410 --- src/shared/exit-status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shared/exit-status.c') diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c index 44b1c9b749..3704f5d481 100644 --- a/src/shared/exit-status.c +++ b/src/shared/exit-status.c @@ -99,7 +99,7 @@ const ExitStatusMapping exit_status_mappings[256] = { const char* exit_status_to_string(int code, ExitStatusClass class) { if (code < 0 || (size_t) code >= ELEMENTSOF(exit_status_mappings)) return NULL; - return FLAGS_SET(exit_status_mappings[code].class, class) ? exit_status_mappings[code].name : NULL; + return class & exit_status_mappings[code].class ? exit_status_mappings[code].name : NULL; } const char* exit_status_class(int code) { -- cgit v1.2.1