@@ -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"])
@@ -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;
@@ -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) {
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@redhat.com> --- configure.ac | 1 + utils/mount/stropts.c | 2 ++ utils/nfsstat/nfsstat.c | 2 ++ 3 files changed, 5 insertions(+)