chiark / gitweb /
network: fix scanf/printf format
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 1 Jan 2015 16:15:50 +0000 (11:15 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 1 Jan 2015 18:36:43 +0000 (13:36 -0500)
usec_t is defined as 64 bit wide, but long is 32 bit on many archs.

src/libsystemd-network/sd-lldp.c
src/network/networkctl.c

index fa45310..86c734b 100644 (file)
@@ -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)
index 15dfb81..cc3ea85 100644 (file)
@@ -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++;
                         }
                 }