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.
This commit is contained in:
+2
-2
@@ -1497,9 +1497,9 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
|
||||
* possible, which means we should avoid the low-level unit
|
||||
* name. */
|
||||
log_struct(LOG_INFO,
|
||||
mid,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_MESSAGE("%s", buf),
|
||||
LOG_UNIT_ID(u),
|
||||
mid,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user