Added the -Werror=format=2 warning flag and added couple pragma statments to ignore the warning where it could not be avoided. Signed-off-by: Steve Dickson <steved@xxxxxxxxxx> --- configure.ac | 1 + utils/mount/stropts.c | 2 ++ utils/nfsstat/nfsstat.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 4f9d8c4..11b994b 100644 --- a/configure.ac +++ b/configure.ac @@ -551,6 +551,7 @@ my_am_cflags="\ -Werror=missing-prototypes \ -Werror=missing-declarations \ -Werror=format-overflow=2 \ + -Werror=format=2 \ " AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 1217823..777de39 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -761,9 +761,11 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, fmt = "vers=%lu.%lu"; break; } +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(version_opt, sizeof(version_opt) - 1, fmt, mi->version.major, mi->version.minor); +#pragma GCC diagnostic warning "-Wformat-nonliteral" if (po_append(options, version_opt) == PO_FAILED) { errno = EINVAL; diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index 43fe0a8..c779053 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -980,8 +980,10 @@ more_stats: } bufp = buf; for (; curindex < numvals; curindex++) { +#pragma GCC diagnostic ignored "-Wformat-nonliteral" n = sscanf(bufp, fmt, &ip->valptr[curindex], &numconsumed); +#pragma GCC diagnostic warning "-Wformat-nonliteral" if (n != 1) break; if (is_proc) { -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html