summaryrefslogtreecommitdiff
path: root/lib/openat.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-11-23 13:35:09 +0000
committerJim Meyering <jim@meyering.net>2005-11-23 13:35:09 +0000
commite8609798de7b1085a11afd33064a08ff18f77cbe (patch)
tree43da4a5a04176967c05d12b8a5ad9d5be044791b /lib/openat.c
parent1000eb18b608982d04fd4d6d27d2ea8501cb19b6 (diff)
downloadcoreutils-e8609798de7b1085a11afd33064a08ff18f77cbe.tar.xz
(fdopendir): Don't change errno when returning non-NULL.
Diffstat (limited to 'lib/openat.c')
-rw-r--r--lib/openat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/openat.c b/lib/openat.c
index 2300208f8..1bd4d73c8 100644
--- a/lib/openat.c
+++ b/lib/openat.c
@@ -232,7 +232,7 @@ fdopendir (int fd)
char *proc_file;
BUILD_PROC_NAME (proc_file, fd, ".");
dir = opendir (proc_file);
- saved_errno = errno;
+ saved_errno = (dir == NULL ? errno : 0);
/* If the syscall succeeded, or if it failed with an unexpected
errno value, then return right away. Otherwise, fall through
and resort to using save_cwd/restore_cwd. */