]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #25470 from keszybz/strv-extendf-format
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Nov 2022 03:27:37 +0000 (12:27 +0900)
committerGitHub <noreply@github.com>
Tue, 22 Nov 2022 03:27:37 +0000 (12:27 +0900)
Improve check for strv_extendf() format string

src/basic/strv.h
src/core/timer.c

index 87a7038a54744ab18b9cf4b89a00ed86db4e5a78..f82c76589d06a5b99988074d0a85caf874f48435 100644 (file)
@@ -45,7 +45,7 @@ static inline int strv_extend(char ***l, const char *value) {
         return strv_extend_with_size(l, NULL, value);
 }
 
-int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
+int strv_extendf(char ***l, const char *format, ...) _printf_(2,3);
 int strv_extend_front(char ***l, const char *value);
 
 int strv_push_with_size(char ***l, size_t *n, char *value);
index 8bd430b931d1d540b8518d4c618391f88f7d09ff..b6810c8599b836833d32548a8f11703a709efe39 100644 (file)
@@ -948,11 +948,11 @@ static int activation_details_timer_append_env(ActivationDetails *details, char
         if (!dual_timestamp_is_set(&t->last_trigger))
                 return 0;
 
-        r = strv_extendf(strv, "TRIGGER_TIMER_REALTIME_USEC=%" USEC_FMT, t->last_trigger.realtime);
+        r = strv_extendf(strv, "TRIGGER_TIMER_REALTIME_USEC=" USEC_FMT, t->last_trigger.realtime);
         if (r < 0)
                 return r;
 
-        r = strv_extendf(strv, "TRIGGER_TIMER_MONOTONIC_USEC=%" USEC_FMT, t->last_trigger.monotonic);
+        r = strv_extendf(strv, "TRIGGER_TIMER_MONOTONIC_USEC=" USEC_FMT, t->last_trigger.monotonic);
         if (r < 0)
                 return r;
 
@@ -974,7 +974,7 @@ static int activation_details_timer_append_pair(ActivationDetails *details, char
         if (r < 0)
                 return r;
 
-        r = strv_extendf(strv, "%" USEC_FMT, t->last_trigger.realtime);
+        r = strv_extendf(strv, USEC_FMT, t->last_trigger.realtime);
         if (r < 0)
                 return r;
 
@@ -982,7 +982,7 @@ static int activation_details_timer_append_pair(ActivationDetails *details, char
         if (r < 0)
                 return r;
 
-        r = strv_extendf(strv, "%" USEC_FMT, t->last_trigger.monotonic);
+        r = strv_extendf(strv, USEC_FMT, t->last_trigger.monotonic);
         if (r < 0)
                 return r;