Add casts when storing values in a struct timespec.

Fixes -Wconversion warnings on some 32-bit systems where time_t is
still 32-bit.
This commit is contained in:
Todd C. Miller
2023-09-27 15:11:10 -06:00
parent 9cc57f4936
commit 1398289fab
11 changed files with 29 additions and 28 deletions

View File

@@ -382,11 +382,11 @@ json_store_timespec(struct json_item *item, struct timespec *ts)
if (item->type != JSON_NUMBER)
continue;
if (strcmp(item->name, "seconds") == 0) {
ts->tv_sec = item->u.number;
ts->tv_sec = (time_t)item->u.number;
continue;
}
if (strcmp(item->name, "nanoseconds") == 0) {
ts->tv_nsec = item->u.number;
ts->tv_nsec = (long)item->u.number;
continue;
}
}