From 4ec0ffde42b79cfde698e4f31cd6d0b72d735574 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 29 May 2014 10:31:30 -0700 Subject: [PATCH] fix format warnings Enable format security, and fix the warning caused by printing with string for format. --- Makefile | 2 +- ip/ipaddress.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 543d9e8e..9dbb29f3 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ HOSTCC = gcc DEFINES += -D_GNU_SOURCE CCOPTS = -O2 WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes -WFLAGS += -Wmissing-declarations -Wold-style-definition +WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) YACCFLAGS = -d -t -v diff --git a/ip/ipaddress.c b/ip/ipaddress.c index ce5e762c..76f47823 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -357,7 +357,7 @@ static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s, fprintf(fp, " TX errors: aborted fifo window heartbeat"); if (carrier_changes) fprintf(fp, " transns"); - fprintf(fp, _SL_); + fprintf(fp, "%s", _SL_); fprintf(fp, " %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-8"PRIu64"", (uint64_t)s->tx_aborted_errors, (uint64_t)s->tx_fifo_errors, @@ -406,7 +406,7 @@ static void print_link_stats(FILE *fp, const struct rtnl_link_stats *s, fprintf(fp, " TX errors: aborted fifo window heartbeat"); if (carrier_changes) fprintf(fp, " transns"); - fprintf(fp, _SL_); + fprintf(fp, "%s", _SL_); fprintf(fp, " %-7u %-7u %-7u %-8u", s->tx_aborted_errors, s->tx_fifo_errors,