From ba360bb05ce9b0bb86821fcdfebf66ccd9f7efd5 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 20 Apr 2017 14:15:28 -0400 Subject: tree-wide: mark log_struct with _printf_ and fix fallout log_struct takes multiple format strings, each one followed by arguments. The _printf_ annotation is not sufficiently flexible to express this, but we can still annotate the first format string, though not its arguments (because their number is unknown). With the annotation, the places which specified the message id or similar as the first pattern cause a warning from -Wformat-nonliteral. This can be trivially fixed by putting the MESSAGE= first. This change will help find issues where a non-literal is erroneously used as the pattern. --- src/core/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/service.c') diff --git a/src/core/service.c b/src/core/service.c index 74054887b9..185173a542 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2693,7 +2693,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : (code == CLD_EXITED ? LOG_NOTICE : LOG_WARNING), - LOG_UNIT_ID(u), LOG_UNIT_MESSAGE(u, "Main process exited, code=%s, status=%i/%s", sigchld_code_to_string(code), status, strna(code == CLD_EXITED @@ -2701,6 +2700,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { : signal_to_string(status))), "EXIT_CODE=%s", sigchld_code_to_string(code), "EXIT_STATUS=%i", status, + LOG_UNIT_ID(u), NULL); if (s->result == SERVICE_SUCCESS) -- cgit v1.2.3-54-g00ecf