summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-09-02 02:05:09 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-09-02 02:06:58 -0700
commit8ac17a6ad40103e78e2905878c8d3d64b2f82894 (patch)
treedb7b42a39229853c1d4f10c7eba3353d81b4c1ee
parent742b1c14418dd3085c2e49aa05300399fb791360 (diff)
downloadgnulib-8ac17a6ad40103e78e2905878c8d3d64b2f82894.tar.gz
glob: don't save and restore errno unnecessarily
* lib/glob.c (glob): Don't save and restore errno merely because we have getpwnam_r.
-rw-r--r--ChangeLog4
-rw-r--r--lib/glob.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4314e917f7..867662d5d3 100644
--- 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.
diff --git a/lib/glob.c b/lib/glob.c
index e9cf775c5d..8de2d5fe90 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -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);