summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-01 11:15:50 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-01 13:36:43 -0500
commitef7532531942d59f81bfbd8a8f923f17e4827952 (patch)
treef686c9f60e39f34bdf6407d91d6cb67890847fe2
parente65ef51dee7a7d3565f471b67f29a257c6128fb3 (diff)
network: fix scanf/printf format
usec_t is defined as 64 bit wide, but long is 32 bit on many archs.
-rw-r--r--src/libsystemd-network/sd-lldp.c2
-rw-r--r--src/network/networkctl.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index fa45310059..86c734b8c2 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -495,7 +495,7 @@ int sd_lldp_save(sd_lldp *lldp, const char *lldp_file) {
if (time - p->until <= 0)
continue;
- sprintf(buf, "'_TTL=%lu' ", p->until);
+ sprintf(buf, "'_TTL="USEC_FMT"' ", p->until);
k = strappend(s, buf);
if (!k)
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 15dfb81e2a..cc3ea85e8c 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -972,7 +972,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
time = now(CLOCK_BOOTTIME);
- sscanf(b, "%lu", &until);
+ sscanf(b, USEC_FMT, &until);
ttl = (until - time) / USEC_PER_SEC;
@@ -986,7 +986,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
}
if (until > time) {
- printf("%10s %24s %16s %16lu %16s\n", links[i].name, chassis, port, ttl, cap);
+ printf("%10s %24s %16s %16"PRIu64" %16s\n", links[i].name, chassis, port, ttl, cap);
j++;
}
}