]> Savannah Git Hosting - gnulib.git/commitdiff
glob: fix getpwnam_r errno typo
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2017 10:56:06 +0000 (03:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2017 10:57:04 +0000 (03:57 -0700)
* lib/glob.c (glob): Fix longstanding misuse of errno after
getpwnam_r, which returns an error number rather than setting
errno.

ChangeLog
lib/glob.c

index 4dd0367e43ca4f548ed704c77752c5f7454b4c01..b5c3430ef3597e8805ff3a338d7360fab444b57e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-09-02  Paul Eggert  <eggert@cs.ucla.edu>
 
+       glob: fix getpwnam_r errno typo
+       * lib/glob.c (glob): Fix longstanding misuse of errno after
+       getpwnam_r, which returns an error number rather than setting
+       errno.
+
        glob: fix typo in recent change
        * lib/glob.c (glob) [!HAVE_GETPWNAM_R && !_LIBC]:
        Fix recently-introduced typo.
index f1b30ee4612fe4aa9603c3718daf4f9612c196a1..7ca11361ec741575509c1bd8ecdd90a55ef5cfb9 100644 (file)
@@ -644,13 +644,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 
                   while (getpwnam_r (name, &pwbuf,
                                      pwtmpbuf.data, pwtmpbuf.length, &p)
-                         != 0)
+                         == ERANGE)
                     {
-                      if (errno != ERANGE)
-                        {
-                          p = NULL;
-                          break;
-                        }
                       if (!scratch_buffer_grow (&pwtmpbuf))
                         {
                           retval = GLOB_NOSPACE;
@@ -815,13 +810,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
             struct passwd pwbuf;
 
             while (getpwnam_r (user_name, &pwbuf,
-                               pwtmpbuf.data, pwtmpbuf.length, &p) != 0)
+                               pwtmpbuf.data, pwtmpbuf.length, &p)
+                   == ERANGE)
               {
-                if (errno != ERANGE)
-                  {
-                    p = NULL;
-                    break;
-                  }
                 if (!scratch_buffer_grow (&pwtmpbuf))
                   {
                     retval = GLOB_NOSPACE;