37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
From edb4a8769c1edd99b7cf618fa1970325b7ecc55a Mon Sep 17 00:00:00 2001
|
|
From: Jim Warner <james.warner@comcast.net>
|
|
Date: Mon, 30 Dec 2024 00:00:00 -0600
|
|
Subject: [PATCH] uptime: address the 'raw' option 32-bit overflow issue
|
|
|
|
Linux ensures that time_t is at least 64 bits, even on
|
|
32 bit platforms, to prevent an overflow in year 2038.
|
|
|
|
This patch guarantees uptime won't negate that effort.
|
|
|
|
Reference(s):
|
|
https://gitlab.com/procps-ng/procps/-/issues/362
|
|
|
|
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
|
---
|
|
src/uptime.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/uptime.c b/src/uptime.c
|
|
index a38486b0..b35ebdae 100644
|
|
--- src/uptime.c
|
|
+++ src/uptime.c
|
|
@@ -97,8 +97,8 @@ static void print_uptime_raw()
|
|
if (procps_loadavg(&av1, &av5, &av15) < 0)
|
|
xerrx(EXIT_FAILURE, "procps_loadavg");
|
|
|
|
- printf("%d %f %d %.2f %.2f %.2f\n",
|
|
- (int)realseconds, uptime_secs, users, av1, av5, av15);
|
|
+ printf("%lld %f %d %.2f %.2f %.2f\n",
|
|
+ (long long)realseconds, uptime_secs, users, av1, av5, av15);
|
|
}
|
|
static void __attribute__ ((__noreturn__)) usage(FILE * out)
|
|
{
|
|
--
|
|
GitLab
|
|
|