Skip to content

Commit a5c4428

Browse files
committed
Cast timestamps to uint64_t to fix compatibility issue with 64-bit time.
This has been causing crashes on recent OpenWRT Archer C7v2 builds.
1 parent f52a85f commit a5c4428

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/logging.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdarg.h>
2+
#include <stdint.h>
23
#include <stdio.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
34
#include <sys/time.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
45
#include <unistd.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
@@ -77,8 +78,9 @@ void _log(const char *file, int line, int severity, const char *fmt, ...) {
7778

7879
struct timeval tv;
7980
gettimeofday(&tv, NULL);
80-
fprintf(logf, "%s %8ld.%06ld %s:%d ", SeverityStr[severity], tv.tv_sec,
81-
tv.tv_usec, file, line);
81+
fprintf(logf, "%s %8lu.%06lu %s:%d ", SeverityStr[severity],
82+
(uint64_t)tv.tv_sec,
83+
(uint64_t)tv.tv_usec, file, line);
8284

8385
va_list args;
8486
va_start(args, fmt);

src/options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct Options {
5151

5252
// Path to a file containing CA certificates
5353
const char *ca_info;
54-
};
54+
} __attribute__((aligned(128)));
5555
typedef struct Options options_t;
5656

5757
#ifdef __cplusplus

0 commit comments

Comments
 (0)