aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2023-07-24 14:15:23 -0300
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-01-31 17:25:12 +0100
commitf2f68a13f112d68d83333498ef9edddaadfbcace (patch)
tree80e8e06947a6d74317de614ceb998d5aa7fc6d79
parentlibio: Check remaining buffer size in _IO_wdo_write (bug 31183) (diff)
downloadglibc-f2f68a13f112d68d83333498ef9edddaadfbcace.tar.gz
glibc-f2f68a13f112d68d83333498ef9edddaadfbcace.tar.bz2
glibc-f2f68a13f112d68d83333498ef9edddaadfbcace.zip
sunrpc: Fix netname build with older gcc
The -Wformat-overflow was added by gcc 8. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 0eb6b2725ba4aae73c03ac1f05c31cd2a073c99a) (cherry picked from commit 8b8a3f0aafa30510abc5809db99c026af9a48016)
-rw-r--r--sunrpc/netname.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index dd2cb1b441..6641d25625 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -52,10 +52,14 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
/* GCC with -Os or -O1 warns that sprint might overflow while handling
dfltdom, however the above test does check if an overflow would
happen. */
+#if __GNUC_PREREQ (8, 0)
DIAG_PUSH_NEEDS_COMMENT;
DIAG_IGNORE_NEEDS_COMMENT (8, "-Wformat-overflow");
+#endif
sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+#if __GNUC_PREREQ (8, 0)
DIAG_POP_NEEDS_COMMENT;
+#endif
i = strlen (netname);
if (netname[i - 1] == '.')
netname[i - 1] = '\0';