]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sunrpc: Fix netname build with older gcc
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Mon, 24 Jul 2023 17:15:23 +0000 (14:15 -0300)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 29 Jan 2024 21:22:40 +0000 (22:22 +0100)
The -Wformat-overflow was added by gcc 8.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 0eb6b2725ba4aae73c03ac1f05c31cd2a073c99a)

sunrpc/netname.c

index dd2cb1b441cc6c344a458e242e2a2a1dbc97c07e..6641d256253889a8699b41aecf50dc69be1f8697 100644 (file)
@@ -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';