On 12/13/2017 01:38 AM, Tim Rühsen wrote:
Here is a patch to silence this warning:

glob.c: In function 'rpl_glob':
glob.c:618:64: warning: pointer of type 'void *' used in arithmetic
[-Wpointer-arith]
                        err = getpwnam_r (s.data, &pwbuf, s.data + ssize,


With Best Regards, Tim

Thanks, I tweaked it slightly to avoid inserting a cast (as it's better to avoid casts when it's easy), and installed the attached patch into Gnulib, in your name. I'll CC: Adhemerval as this should go into glibc too, at some point.

>From 68e3914459c44e8cb2fed2a78840bd03c1b35084 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
Date: Fri, 15 Dec 2017 17:27:21 -0800
Subject: [PATCH] glob.c: Silence warning about void pointer arithmetic

---
 lib/glob.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/glob.c b/lib/glob.c
index 511be12dd..ee2f9be13 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -615,7 +615,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
                     {
 # if defined HAVE_GETPWNAM_R || defined _LIBC
                       size_t ssize = strlen (s.data) + 1;
-                      err = getpwnam_r (s.data, &pwbuf, s.data + ssize,
+                      char *sdata = s.data;
+                      err = getpwnam_r (sdata, &pwbuf, sdata + ssize,
                                         s.length - ssize, &p);
 # else
                       p = getpwnam (s.data);
-- 
2.14.3

Reply via email to