[PATCH] Fix -Wformat-length warning in tst-setgetname.c
Steve Ellcey
sellcey@caviumnetworks.com
Mon Oct 24 16:08:00 GMT 2016
Here is another patch to fix a new warning (-Wformat-length) coming
from GCC 7.0.  If GCC thinks an snprintf might overrun the buffer being
written to, it gives a warning.  This patch increases the buffer size
so that the warning is no longer given.
OK to checkin?
Steve Ellcey
sellcey@caviumnetworks.com
2016-10-24  Steve Ellcey  <sellcey@caviumnetworks.com>
* sysdeps/unix/sysv/linux/tst-setgetname.c: Increase buffer size.
diff --git a/sysdeps/unix/sysv/linux/tst-setgetname.c b/sysdeps/unix/sysv/linux/
tst-setgetname.c
index f490d83..30fbe4e 100644
--- a/sysdeps/unix/sysv/linux/tst-setgetname.c
+++ b/sysdeps/unix/sysv/linux/tst-setgetname.c
@@ -56,7 +56,7 @@ get_self_comm (long tid, char *buf, size_t len)
 {
   int res = 0;
 #define FMT "/proc/self/task/%lu/comm"
-Â Â char fname[sizeof (FMT) + 8];
+Â Â char fname[sizeof (FMT) + 32];
   sprintf (fname, FMT, (unsigned long) tid);
Â
   int fd = open (fname, O_RDONLY);
More information about the Libc-alpha
mailing list