Module: kamailio Branch: master Commit: fe68c9aeb06f114afdc6c0b076b5163e34deeea5 URL: https://github.com/kamailio/kamailio/commit/fe68c9aeb06f114afdc6c0b076b5163e...
Author: Sebastian Kemper sebastian_ml@gmx.net Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-11-03T13:03:34+01:00
nat_traversal: use TIME_T_FMT
The size of the time_t destination is unknown as it is depending on the platform. So we "read into a known-size integer (either int or long long) and then assign the value to a time_t as a second step" (quote from [1]).
[1] https://stackoverflow.com/questions/4171478/how-to-read-data-into-a-time-t-v...
Signed-off-by: Sebastian Kemper sebastian_ml@gmx.net
---
Modified: src/modules/nat_traversal/nat_traversal.c
---
Diff: https://github.com/kamailio/kamailio/commit/fe68c9aeb06f114afdc6c0b076b5163e... Patch: https://github.com/kamailio/kamailio/commit/fe68c9aeb06f114afdc6c0b076b5163e...
---
diff --git a/src/modules/nat_traversal/nat_traversal.c b/src/modules/nat_traversal/nat_traversal.c index 4cfe8d4018..edaa6dfe3d 100644 --- a/src/modules/nat_traversal/nat_traversal.c +++ b/src/modules/nat_traversal/nat_traversal.c @@ -1707,6 +1707,7 @@ static void restore_keepalive_state(void) unsigned h; str host; FILE *f; + long long ll_1, ll_2;
if(!keepalive_state_file) return; @@ -1724,7 +1725,9 @@ static void restore_keepalive_state(void) res = fscanf(f, STATE_FILE_HEADER); // skip header
while(true) { - res = fscanf(f, "%63s %63s %ld %ld", uri, socket, &rtime, &stime); + res = fscanf(f, "%63s %63s %" TIME_T_FMT " %" TIME_T_FMT, uri, socket, &ll_1, &ll_2); + rtime = ll_1; + stime = ll_2; if(res == EOF) { if(ferror(f)) LM_ERR("error while reading keepalive state file: %s\n",