ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 5cec192e0c86a24bad9c3b24eca7d655470382df Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Mon, 7 Jul 2014 21:40:00 +0200
Subject: [PATCH] dropin: add format attribute and fix a wrong caller

(cherry picked from commit f5a4b0d3534bb13ef734a857647ab04be236c6f3)
---
 src/shared/dropin.h    | 4 +++-
 src/shared/generator.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/shared/dropin.h b/src/shared/dropin.h
index 27a2b2953f..9c9742d0e4 100644
--- a/src/shared/dropin.h
+++ b/src/shared/dropin.h
@@ -21,6 +21,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include "macro.h"
+
 int drop_in_file(const char *dir, const char *unit, unsigned level,
                  const char *name, char **_p, char **_q);
 
@@ -28,4 +30,4 @@ int write_drop_in(const char *dir, const char *unit, unsigned level,
                   const char *name, const char *data);
 
 int write_drop_in_format(const char *dir, const char *unit, unsigned level,
-                         const char *name, const char *format, ...);
+                         const char *name, const char *format, ...) _printf_(5, 6);
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 2f9e5954c2..5d4cb5d54f 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -148,7 +148,7 @@ int generator_write_timeouts(const char *dir, const char *what, const char *wher
 
         return write_drop_in_format(dir, unit, 50, "device-timeout",
                                     "# Automatically generated by %s\n\n"
-                                    "[Unit]\nJobTimeoutSec=%u",
+                                    "[Unit]\nJobTimeoutSec=%lu",
                                     program_invocation_short_name,
                                     u / USEC_PER_SEC);
 }