aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriadne Conill <ariadne@dereferenced.org>2021-09-08 23:50:44 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2021-09-09 12:36:25 -0500
commit25d5de8fd9698fed0fdbbd8949fd4089602b796d (patch)
tree30e00faaf5233cc29ce8fa8f25c19cae439df10d
parentb5cf79f7472e187c82f0acbee5311b868d1605b0 (diff)
fix build under musl 1.2 on 32 bit systems
Since musl 1.2 time_t is a 64 bit value, even on 32 bit systems. A hotfix for printing the value is simply using PRIu64 from inttypes.h in the format string. This fixes #446.
-rw-r--r--src/rc/rc-status.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index cd32c091..6c562319 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <inttypes.h>
#include "einfo.h"
#include "queue.h"
@@ -128,12 +129,12 @@ static char *get_uptime(const char *service)
}
if (diff_days > 0)
xasprintf(&uptime,
- "%ld day(s) %02ld:%02ld:%02ld (%s)",
+ "%"PRId64" day(s) %02"PRId64":%02"PRId64":%02"PRId64" (%s)",
diff_days, diff_hours, diff_mins, diff_secs,
start_count);
else
xasprintf(&uptime,
- "%02ld:%02ld:%02ld (%s)",
+ "%02"PRId64":%02"PRId64":%02"PRId64" (%s)",
diff_hours, diff_mins, diff_secs, start_count);
}
}