Commit 09e6236a authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Use %u when printing an unsigned int.

parent 0ae3988f
...@@ -1122,7 +1122,7 @@ dump_tables(FILE *out) ...@@ -1122,7 +1122,7 @@ dump_tables(FILE *out)
FOR_ALL_NEIGHBOURS(neigh) { FOR_ALL_NEIGHBOURS(neigh) {
fprintf(out, "Neighbour %s dev %s reach %04x ureach %04x " fprintf(out, "Neighbour %s dev %s reach %04x ureach %04x "
"rxcost %d txcost %d rtt %s rttcost %d chan %d%s.\n", "rxcost %u txcost %d rtt %s rttcost %u chan %d%s.\n",
format_address(neigh->address), format_address(neigh->address),
neigh->ifp->name, neigh->ifp->name,
neigh->hello.reach, neigh->hello.reach,
......
...@@ -295,7 +295,7 @@ interface_up(struct interface *ifp, int up) ...@@ -295,7 +295,7 @@ interface_up(struct interface *ifp, int up)
rc = kernel_setup_interface(1, ifp->name, ifp->ifindex); rc = kernel_setup_interface(1, ifp->name, ifp->ifindex);
if(rc < 0) { if(rc < 0) {
fprintf(stderr, "kernel_setup_interface(%s, %d) failed.\n", fprintf(stderr, "kernel_setup_interface(%s, %u) failed.\n",
ifp->name, ifp->ifindex); ifp->name, ifp->ifindex);
goto fail; goto fail;
} }
...@@ -308,7 +308,7 @@ interface_up(struct interface *ifp, int up) ...@@ -308,7 +308,7 @@ interface_up(struct interface *ifp, int up)
mtu = kernel_interface_mtu(ifp->name, ifp->ifindex); mtu = kernel_interface_mtu(ifp->name, ifp->ifindex);
if(mtu < 0) { if(mtu < 0) {
fprintf(stderr, "Warning: couldn't get MTU of interface %s (%d).\n", fprintf(stderr, "Warning: couldn't get MTU of interface %s (%u).\n",
ifp->name, ifp->ifindex); ifp->name, ifp->ifindex);
mtu = 1280; mtu = 1280;
} }
...@@ -318,7 +318,7 @@ interface_up(struct interface *ifp, int up) ...@@ -318,7 +318,7 @@ interface_up(struct interface *ifp, int up)
/* In IPv6, the minimum MTU is 1280, and every host must be able /* In IPv6, the minimum MTU is 1280, and every host must be able
to reassemble up to 1500 bytes, but I'd rather not rely on this. */ to reassemble up to 1500 bytes, but I'd rather not rely on this. */
if(mtu < 128) { if(mtu < 128) {
fprintf(stderr, "Suspiciously low MTU %d on interface %s (%d).\n", fprintf(stderr, "Suspiciously low MTU %d on interface %s (%u).\n",
mtu, ifp->name, ifp->ifindex); mtu, ifp->name, ifp->ifindex);
mtu = 128; mtu = 128;
} }
...@@ -338,7 +338,7 @@ interface_up(struct interface *ifp, int up) ...@@ -338,7 +338,7 @@ interface_up(struct interface *ifp, int up)
rc = resize_receive_buffer(mtu); rc = resize_receive_buffer(mtu);
if(rc < 0) if(rc < 0)
fprintf(stderr, "Warning: couldn't resize " fprintf(stderr, "Warning: couldn't resize "
"receive buffer for interface %s (%d) (%d bytes).\n", "receive buffer for interface %s (%u) (%d bytes).\n",
ifp->name, ifp->ifindex, mtu); ifp->name, ifp->ifindex, mtu);
type = IF_CONF(ifp, type); type = IF_CONF(ifp, type);
...@@ -349,7 +349,7 @@ interface_up(struct interface *ifp, int up) ...@@ -349,7 +349,7 @@ interface_up(struct interface *ifp, int up)
rc = kernel_interface_wireless(ifp->name, ifp->ifindex); rc = kernel_interface_wireless(ifp->name, ifp->ifindex);
if(rc < 0) { if(rc < 0) {
fprintf(stderr, fprintf(stderr,
"Warning: couldn't determine whether %s (%d) " "Warning: couldn't determine whether %s (%u) "
"is a wireless interface.\n", "is a wireless interface.\n",
ifp->name, ifp->ifindex); ifp->name, ifp->ifindex);
} else if(rc) { } else if(rc) {
...@@ -422,8 +422,8 @@ interface_up(struct interface *ifp, int up) ...@@ -422,8 +422,8 @@ interface_up(struct interface *ifp, int up)
IF_CONF(ifp, rtt_max) : 120000; IF_CONF(ifp, rtt_max) : 120000;
if(ifp->rtt_max <= ifp->rtt_min) { if(ifp->rtt_max <= ifp->rtt_min) {
fprintf(stderr, fprintf(stderr,
"Uh, rtt-max is less than or equal to rtt-min (%d <= %d). " "Uh, rtt-max is less than or equal to rtt-min (%u <= %u). "
"Setting it to %d.\n", ifp->rtt_max, ifp->rtt_min, "Setting it to %u.\n", ifp->rtt_max, ifp->rtt_min,
ifp->rtt_min + 10000); ifp->rtt_min + 10000);
ifp->rtt_max = ifp->rtt_min + 10000; ifp->rtt_max = ifp->rtt_min + 10000;
} }
......
...@@ -588,7 +588,7 @@ print_kernel_route(int add, struct kernel_route *route) ...@@ -588,7 +588,7 @@ print_kernel_route(int add, struct kernel_route *route)
memcpy(ifname,"unk",4); memcpy(ifname,"unk",4);
fprintf(stderr, fprintf(stderr,
"%s kernel route: dest: %s gw: %s metric: %d if: %s(%d) \n", "%s kernel route: dest: %s gw: %s metric: %d if: %s(%u) \n",
add == RTM_ADD ? "Add" : add == RTM_ADD ? "Add" :
add == RTM_DELETE ? "Delete" : "Change", add == RTM_DELETE ? "Delete" : "Change",
format_prefix(route->prefix, route->plen), format_prefix(route->prefix, route->plen),
......
...@@ -145,7 +145,7 @@ local_notify_neighbour_1(struct local_socket *s, ...@@ -145,7 +145,7 @@ local_notify_neighbour_1(struct local_socket *s,
rttbuf[0] = '\0'; rttbuf[0] = '\0';
if(valid_rtt(neigh)) { if(valid_rtt(neigh)) {
rc = snprintf(rttbuf, 64, " rtt %s rttcost %d", rc = snprintf(rttbuf, 64, " rtt %s rttcost %u",
format_thousands(neigh->rtt), neighbour_rttcost(neigh)); format_thousands(neigh->rtt), neighbour_rttcost(neigh));
if(rc < 0 || rc >= 64) if(rc < 0 || rc >= 64)
rttbuf[0] = '\0'; rttbuf[0] = '\0';
...@@ -154,7 +154,7 @@ local_notify_neighbour_1(struct local_socket *s, ...@@ -154,7 +154,7 @@ local_notify_neighbour_1(struct local_socket *s,
rc = snprintf(buf, 512, rc = snprintf(buf, 512,
"%s neighbour %lx address %s " "%s neighbour %lx address %s "
"if %s reach %04x ureach %04x " "if %s reach %04x ureach %04x "
"rxcost %d txcost %d%s cost %d\n", "rxcost %u txcost %u%s cost %u\n",
local_kind(kind), local_kind(kind),
/* Neighbours never move around in memory , so we can use the /* Neighbours never move around in memory , so we can use the
address as a unique identifier. */ address as a unique identifier. */
......
...@@ -302,7 +302,7 @@ format_thousands(unsigned int value) ...@@ -302,7 +302,7 @@ format_thousands(unsigned int value)
static char buf[4][15]; static char buf[4][15];
static int i = 0; static int i = 0;
i = (i + 1) % 4; i = (i + 1) % 4;
snprintf(buf[i], 15, "%d.%.3d", value / 1000, value % 1000); snprintf(buf[i], 15, "%u.%.3u", value / 1000, value % 1000);
return buf[i]; return buf[i];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment