library: silence the clang warning for 'uptime' module
authorJim Warner <james.warner@comcast.net>
Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Fri, 20 May 2022 06:23:20 +0000 (16:23 +1000)
Reference(s):
proc/uptime.c:191:9: warning: variable 'uphours' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/uptime.c

index 088cd68a8b6a446ad79c5d83fdf2e0f554efff8c..b4d9ba9d3062759e5f404a687025befe4a52ea68 100644 (file)
@@ -151,7 +151,7 @@ PROCPS_EXPORT char *procps_uptime_sprint(void)
  */
 PROCPS_EXPORT char *procps_uptime_sprint_short(void)
 {
-    int updecades, upyears, upweeks, updays, uphours, upminutes = 0;
+    int updecades, upyears, upweeks, updays, uphours = 0, upminutes = 0;
     int pos = 3;
     int comma = 0;
     double uptime_secs, idle_secs;