diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 7ce80f85..c4816bc2 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -65,8 +65,7 @@ static void dcb_app_table_fini(struct dcb_app_table *tab) static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app) { - struct dcb_app *apps = reallocarray(tab->apps, tab->n_apps + 1, - sizeof(*tab->apps)); + struct dcb_app *apps = realloc(tab->apps, (tab->n_apps + 1) * sizeof(*tab->apps)); if (apps == NULL) { perror("Cannot allocate APP table"); diff --git a/ip/iproute.c b/ip/iproute.c index 291f1a58..5853f026 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -796,9 +796,10 @@ int print_route(struct nlmsghdr *n, void *arg) "%s/%u", rt_addr_n2a_rta(family, tb[RTA_DST]), r->rtm_dst_len); } else { - format_host_rta_r(family, tb[RTA_DST], + const char *hostname = format_host_rta_r(family, tb[RTA_DST], b1, sizeof(b1)); - + if (hostname) + strncpy(b1, hostname, sizeof(b1) - 1); } } else if (r->rtm_dst_len) { snprintf(b1, sizeof(b1), "0/%d ", r->rtm_dst_len); @@ -818,8 +819,10 @@ int print_route(struct nlmsghdr *n, void *arg) rt_addr_n2a_rta(family, tb[RTA_SRC]), r->rtm_src_len); } else { - format_host_rta_r(family, tb[RTA_SRC], + const char *hostname = format_host_rta_r(family, tb[RTA_SRC], b1, sizeof(b1)); + if (hostname) + strncpy(b1, hostname, sizeof(b1) - 1); } print_color_string(PRINT_ANY, color, "from", "from %s ", b1); diff --git a/tc/q_cake.c b/tc/q_cake.c index b7da731b..4ff6056a 100644 --- a/tc/q_cake.c +++ b/tc/q_cake.c @@ -675,7 +675,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f, /* class stats */ if (st[TCA_CAKE_STATS_DEFICIT]) - print_int(PRINT_ANY, "deficit", " deficit %u", + print_int(PRINT_ANY, "deficit", " deficit %d", GET_STAT_S32(DEFICIT)); if (st[TCA_CAKE_STATS_COBALT_COUNT]) print_uint(PRINT_ANY, "count", " count %u", @@ -688,7 +688,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f, if (drop_next < 0) { print_string(PRINT_FP, NULL, " drop_next -%s", - sprint_time(drop_next, b1)); + sprint_time(-drop_next, b1)); } else { print_uint(PRINT_JSON, "drop_next", NULL, drop_next);