]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sunrpc: Suppress GCC -O1 warning on user2netname [BZ #19444]
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 29 Dec 2022 12:58:00 +0000 (09:58 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 11 Jan 2023 20:50:25 +0000 (17:50 -0300)
The same issue described by 6128e82ebe973163d2dd614d31753c88c0c4d645
also happend with -O1.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
sunrpc/netname.c

index 4fde0bf91c94f558ca675aaccb7a5817da52ca38..dd2cb1b441cc6c344a458e242e2a2a1dbc97c07e 100644 (file)
@@ -49,10 +49,11 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
   if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
     return 0;
 
-  /* GCC with -Os warns that sprint might overflow while handling dfltdom,
-     however the above test does check if an overflow would happen.  */
+  /* GCC with -Os or -O1 warns that sprint might overflow while handling
+     dfltdom, however the above test does check if an overflow would
+     happen.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wformat-overflow");
+  DIAG_IGNORE_NEEDS_COMMENT (8, "-Wformat-overflow");
   sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
   DIAG_POP_NEEDS_COMMENT;
   i = strlen (netname);