mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-24 21:40:34 +01:00
Fix format strings on 32-bit with 64-bit time_t
This fixes a segfault when running the test suite on ppc musl Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1318>
This commit is contained in:
parent
5df3eb8527
commit
aa7d58005e
2 changed files with 20 additions and 11 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/timerfd.h>
|
||||
|
|
@ -771,7 +772,8 @@ litest_runner_log_test_result(struct litest_runner *runner,
|
|||
}
|
||||
|
||||
fprintf(runner->fp,
|
||||
" duration: %ld # (ms), total test run time: %02d:%02d\n",
|
||||
" duration: %" PRIu64 " # (ms), total test run time: %02" PRIu32
|
||||
":%02" PRIu32 "\n",
|
||||
t->times.end_millis - t->times.start_millis,
|
||||
(ms2s(t->times.end_millis - runner->times.start_millis)) / 60,
|
||||
(ms2s(t->times.end_millis - runner->times.start_millis)) % 60);
|
||||
|
|
@ -989,7 +991,10 @@ litest_runner_run_tests(struct litest_runner *runner)
|
|||
runner->times.start = time(NULL);
|
||||
ltime = localtime(&runner->times.start);
|
||||
strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime);
|
||||
fprintf(runner->fp, "start: %ld # \"%s\"\n", runner->times.start, timestamp);
|
||||
fprintf(runner->fp,
|
||||
"start: %lld # \"%s\"\n",
|
||||
(long long)runner->times.start,
|
||||
timestamp);
|
||||
fprintf(runner->fp, "jobs: %zd\n", runner->max_forks);
|
||||
fprintf(runner->fp, "tests:\n");
|
||||
list_for_each_safe(t, &runner->tests, node) {
|
||||
|
|
@ -1062,12 +1067,15 @@ litest_runner_run_tests(struct litest_runner *runner)
|
|||
runner->times.end = time(NULL);
|
||||
ltime = localtime(&runner->times.end);
|
||||
strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime);
|
||||
fprintf(runner->fp, "end: %ld # \"%s\"\n", runner->times.end, timestamp);
|
||||
fprintf(runner->fp,
|
||||
"duration: %ld # (s) %02ld:%02ld\n",
|
||||
runner->times.end - runner->times.start,
|
||||
(runner->times.end - runner->times.start) / 60,
|
||||
(runner->times.end - runner->times.start) % 60);
|
||||
"end: %lld # \"%s\"\n",
|
||||
(long long)runner->times.end,
|
||||
timestamp);
|
||||
fprintf(runner->fp,
|
||||
"duration: %lld # (s) %02lld:%02lld\n",
|
||||
(long long)(runner->times.end - runner->times.start),
|
||||
(long long)((runner->times.end - runner->times.start) / 60),
|
||||
(long long)((runner->times.end - runner->times.start) % 60));
|
||||
fprintf(runner->fp, "summary:\n");
|
||||
fprintf(runner->fp, " completed: %zd\n", ncomplete);
|
||||
fprintf(runner->fp, " pass: %zd\n", npass);
|
||||
|
|
|
|||
|
|
@ -1231,7 +1231,6 @@ handle_hidraw(struct hidraw *hidraw)
|
|||
unsigned char report[4096];
|
||||
const char *sep = "";
|
||||
struct timespec ts;
|
||||
struct timeval tv;
|
||||
uint64_t time;
|
||||
|
||||
int rc = read(hidraw->fd, report, sizeof(report));
|
||||
|
|
@ -1251,10 +1250,12 @@ handle_hidraw(struct hidraw *hidraw)
|
|||
else
|
||||
time = time_offset(d->ctx, time);
|
||||
|
||||
tv = us2tv(time);
|
||||
|
||||
iprintf(d->fp, I_EVENTTYPE, "- hid:\n");
|
||||
iprintf(d->fp, I_EVENT, "time: [%3lu, %6lu]\n", tv.tv_sec, tv.tv_usec);
|
||||
iprintf(d->fp,
|
||||
I_EVENT,
|
||||
"time: [%3" PRIu64 ", %6" PRIu64 "]\n",
|
||||
time / s2us(1),
|
||||
time % s2us(1));
|
||||
iprintf(d->fp, I_EVENT, "%s: [", hidraw->name);
|
||||
|
||||
for (int byte = 0; byte < rc; byte++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue