]> Savannah Git Hosting - gnulib.git/commitdiff
glob: don't save and restore errno unnecessarily
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2017 09:05:09 +0000 (02:05 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2017 09:06:58 +0000 (02:06 -0700)
* lib/glob.c (glob): Don't save and restore errno
merely because we have getpwnam_r.

ChangeLog
lib/glob.c

index 4314e917f7df0ffd405e613e3920da713e4720f7..867662d5d3b838dc71d843af08f33b5aa15fe1e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-09-02  Paul Eggert  <eggert@cs.ucla.edu>
 
+       glob: don't save and restore errno unnecessarily
+       * lib/glob.c (glob): Don't save and restore errno
+       merely because we have getpwnam_r.
+
        glob: don't assume getpwnam_r
        * lib/glob.c (glob): Port recent patches to platforms
        lacking getpwnam_r.
index e9cf775c5d533928fd6e9a87d9be24feecdafb1a..8de2d5fe9077f0032367051517a5a7c678c98509 100644 (file)
@@ -637,7 +637,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
               if (success)
                 {
                   struct passwd *p;
-                  int save = errno;
                   struct scratch_buffer pwtmpbuf;
                   scratch_buffer_init (&pwtmpbuf);
 # if defined HAVE_GETPWNAM_R || defined _LIBC
@@ -657,7 +656,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
                           retval = GLOB_NOSPACE;
                           goto out;
                         }
-                      __set_errno (save);
                     }
 # else
                   p = getpwnam (pwtmpbuf.data);
@@ -815,7 +813,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 
 #  if defined HAVE_GETPWNAM_R || defined _LIBC
             struct passwd pwbuf;
-            int save = errno;
 
             while (getpwnam_r (user_name, &pwbuf,
                                pwtmpbuf.data, pwtmpbuf.length, &p) != 0)
@@ -830,7 +827,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
                     retval = GLOB_NOSPACE;
                     goto out;
                   }
-                __set_errno (save);
               }
 #  else
             p = getpwnam (user_name);