From: Stephen Hemminger Date: Thu, 8 Jan 2009 01:20:43 +0000 (-0800) Subject: Fix compile warnings X-Git-Tag: v2.6.28~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a73e17deb231949f11e8ebf1303907c840b29cd;p=thirdparty%2Fiproute2.git Fix compile warnings Gcc now warns about possible errors from passing a string buffer as format arguement to printf(). --- diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c index 0a7d39a89..24b21146b 100644 --- a/ip/ipxfrm.c +++ b/ip/ipxfrm.c @@ -283,7 +283,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id, char abuf[256]; if (title) - fprintf(fp, title); + fputs(title, fp); memset(abuf, '\0', sizeof(abuf)); fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr), @@ -294,7 +294,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id, fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "\t"); fprintf(fp, "proto %s ", strxf_xfrmproto(id->proto)); @@ -350,12 +350,12 @@ static const char *strxf_limit(__u64 limit) void xfrm_stats_print(struct xfrm_stats *s, FILE *fp, const char *prefix) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "stats:"); fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "replay-window %u ", s->replay_window); fprintf(fp, "replay %u ", s->replay); @@ -391,12 +391,12 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, { if (cfg) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "lifetime config:"); fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "limit: "); fprintf(fp, "soft "); @@ -407,7 +407,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "limit: "); fprintf(fp, "soft "); @@ -418,7 +418,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "expire add: "); fprintf(fp, "soft "); @@ -429,7 +429,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "expire use: "); fprintf(fp, "soft "); @@ -441,19 +441,19 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, } if (cur) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "lifetime current:"); fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "%llu(bytes), ", (unsigned long long) cur->bytes); fprintf(fp, "%llu(packets)", (unsigned long long) cur->packets); fprintf(fp, "%s", _SL_); if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, " "); fprintf(fp, "add %s ", strxf_time(cur->add_time)); fprintf(fp, "use %s", strxf_time(cur->use_time)); @@ -474,7 +474,7 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family, f = preferred_family; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); memset(abuf, '\0', sizeof(abuf)); fprintf(fp, "src %s/%u ", rt_addr_n2a(f, sizeof(sel->saddr), @@ -533,7 +533,7 @@ static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len, int i; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "%s ", strxf_algotype(type)); @@ -596,7 +596,7 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len, if (ntmpls <= 0) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "(ERROR \"tmpl\" truncated)"); fprintf(fp, "%s", _SL_); return; @@ -606,14 +606,14 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len, struct xfrm_user_tmpl *tmpl = &tmpls[i]; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); xfrm_id_info_print(&tmpl->saddr, &tmpl->id, tmpl->mode, tmpl->reqid, family, 0, fp, prefix, "tmpl "); if (show_stats > 0 || tmpl->optional) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "\t"); switch (tmpl->optional) { case 0: @@ -636,7 +636,7 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len, if (show_stats > 0) { if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "\t"); fprintf(fp, "%s-mask %s ", strxf_algotype(XFRMA_ALG_CRYPT), @@ -685,7 +685,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, char abuf[256]; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "encap "); if (RTA_PAYLOAD(tb[XFRMA_ENCAP]) < sizeof(*e)) { @@ -728,7 +728,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, xfrm_address_t *coa; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "coa "); coa = (xfrm_address_t *)RTA_DATA(tb[XFRMA_COADDR]); @@ -750,7 +750,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, __u64 lastused; if (prefix) - fprintf(fp, prefix); + fputs(prefix, fp); fprintf(fp, "lastused "); if (RTA_PAYLOAD(tb[XFRMA_LASTUSED]) < sizeof(lastused)) { @@ -792,7 +792,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo, STRBUF_CAT(buf, prefix); STRBUF_CAT(buf, "\t"); - fprintf(fp, buf); + fputs(buf, fp); fprintf(fp, "replay-window %u ", xsinfo->replay_window); if (show_stats > 0) fprintf(fp, "seq 0x%08u ", xsinfo->seq); @@ -842,7 +842,7 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo, STRBUF_CAT(buf, prefix); STRBUF_CAT(buf, "\t"); - fprintf(fp, buf); + fputs(buf, fp); fprintf(fp, "dir "); switch (xpinfo->dir) { case XFRM_POLICY_IN: