Files
ports/net/ocserv/patches/patch-src_occtl_time_c
bket e2eac0a59c Update to ocserv-1.4.0
Changes: https://gitlab.com/openconnect/ocserv/-/releases/1.4.0

From Renaud Allard <renaud AT allard DOT it> (MAINTAINER)
2026-01-23 08:27:41 +00:00

42 lines
1.5 KiB
Plaintext

time_t is 64 bits on all OpenBSD (and NetBSD) arch; cast time values
to a specific-width type to avoid problems on 32-bit arch
Index: src/occtl/time.c
--- src/occtl/time.c.orig
+++ src/occtl/time.c
@@ -36,7 +36,7 @@ void print_time_ival7(char output[MAX_TMPSTR_SIZE], ti
{
time_t t = t1 - t2;
- if ((long)t < 0) {
+ if ((long long)t < 0) {
/* system clock changed? */
snprintf(output, MAX_TMPSTR_SIZE, " ? ");
return;
@@ -44,19 +44,19 @@ void print_time_ival7(char output[MAX_TMPSTR_SIZE], ti
if (t >= 48 * 60 * 60)
/* 2 days or more */
- snprintf(output, MAX_TMPSTR_SIZE, _("%2ludays"),
- (long)t / (24 * 60 * 60));
+ snprintf(output, MAX_TMPSTR_SIZE, _("%2lludays"),
+ (unsigned long long)t / (24 * 60 * 60));
else if (t >= 60 * 60)
/* 1 hour or more */
/* Translation Hint: Hours:Minutes */
- snprintf(output, MAX_TMPSTR_SIZE, _("%2luh:%02um"),
- (long)t / (60 * 60), (unsigned int)((t / 60) % 60));
+ snprintf(output, MAX_TMPSTR_SIZE, _("%2lluh:%02um"),
+ (unsigned long long)t / (60 * 60), (unsigned int)((t / 60) % 60));
else if (t > 60)
/* 1 minute or more */
/* Translation Hint: Minutes:Seconds */
- snprintf(output, MAX_TMPSTR_SIZE, "%2lum:%02us", (long)t / 60,
+ snprintf(output, MAX_TMPSTR_SIZE, "%2llum:%02us", (unsigned long long)t / 60,
(unsigned int)t % 60);
else
/* Translation Hint: Seconds:Centiseconds */
- snprintf(output, MAX_TMPSTR_SIZE, _("%5lus"), (long)t);
+ snprintf(output, MAX_TMPSTR_SIZE, _("%5llus"), (unsigned long long)t);
}