File: 0003-device.c-Unconditionally-cast-tv_-sec-usec-to-lld-fo.patch

package info (click to toggle)
powerman 2.4.4-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,388 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (28 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Boyuan Yang <byang@debian.org>
Date: Wed, 11 Sep 2024 21:30:37 -0400
Subject: device.c: Unconditionally cast tv_{sec,usec} to lld for printf

This avoids FTBFS due to mismatch between 64-bit time_t and printf
formatter when -Werror=format is enabled.

Bug: https://github.com/chaos/powerman/issues/199
Signed-off-by: Boyuan Yang <byang@debian.org>
---
 src/powerman/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/powerman/device.c b/src/powerman/device.c
index 3cd6b42..b193864 100644
--- a/src/powerman/device.c
+++ b/src/powerman/device.c
@@ -1332,8 +1332,8 @@ static bool _process_delay(Device *dev, Action *act, ExecCtx *e,
     /* first time */
     if (!e->processing) {
         if (act->vpf_fun)
-            act->vpf_fun(act->client_id, "delay(%s): %ld.%-6.6ld", dev->name,
-                    delay.tv_sec, delay.tv_usec);
+            act->vpf_fun(act->client_id, "delay(%s): %lld.%-6.6lld", dev->name,
+                    (long long int)delay.tv_sec, (long long int)delay.tv_usec);
         e->processing = true;
         if (gettimeofday(&act->delay_start, NULL) < 0)
             err_exit(true, "gettimeofday");