pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/41955?usp=email )
Change subject: lapd-over-datagram-user: fix printf format for timeval fields ......................................................................
lapd-over-datagram-user: fix printf format for timeval fields
Use inttypes.h and PRI* macros when printing struct timeval members. This avoids format string mismatches and makes the example code portable across architectures where time_t / suseconds_t may differ in size.
No functional change intended.
Change-Id: I7067eae1132c604aff3b37e5dff06fadb0759cb6 --- M doc/examples/lapd-over-datagram/lapd-over-datagram-user.c 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve
diff --git a/doc/examples/lapd-over-datagram/lapd-over-datagram-user.c b/doc/examples/lapd-over-datagram/lapd-over-datagram-user.c index 5eb58e8..eeabe01 100644 --- a/doc/examples/lapd-over-datagram/lapd-over-datagram-user.c +++ b/doc/examples/lapd-over-datagram/lapd-over-datagram-user.c @@ -5,6 +5,7 @@ #include <signal.h> #include <unistd.h> #include <arpa/inet.h> +#include <inttypes.h>
#include <osmocom/core/linuxlist.h> #include <osmocom/core/talloc.h> @@ -163,8 +164,8 @@ timersub(&tv, &found->tv, &diff);
LOGP(DLINP, LOGL_NOTICE, "message %d replied " - "in %lu.%.6lu\n", - num, diff.tv_sec, diff.tv_usec); + "in %" PRIdMAX ".%.6" PRIdMAX "\n", + num, (intmax_t)diff.tv_sec, (intmax_t)diff.tv_usec); talloc_free(found); } else { LOGP(DLINP, LOGL_ERROR,