This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix -Wformat-length warning in tst-setgetname.c
- From: Steve Ellcey <sellcey at caviumnetworks dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Mon, 24 Oct 2016 09:07:57 -0700
- Subject: [PATCH] Fix -Wformat-length warning in tst-setgetname.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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);