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/execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/execute.c') diff --git a/src/core/execute.c b/src/core/execute.c index d7798387c5..29988c22ae 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -2887,9 +2887,9 @@ static int exec_child( if (line) { log_open(); log_struct(LOG_DEBUG, - LOG_UNIT_ID(unit), "EXECUTABLE=%s", command->path, LOG_UNIT_MESSAGE(unit, "Executing: %s", line), + LOG_UNIT_ID(unit), NULL); log_close(); } @@ -2953,9 +2953,9 @@ int exec_spawn(Unit *unit, return log_oom(); log_struct(LOG_DEBUG, - LOG_UNIT_ID(unit), LOG_UNIT_MESSAGE(unit, "About to execute: %s", line), "EXECUTABLE=%s", command->path, + LOG_UNIT_ID(unit), NULL); pid = fork(); if (pid < 0) -- cgit v1.2.3-54-g00ecf