diff options
author | Jim Meyering <jim@meyering.net> | 2005-11-23 13:35:09 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-11-23 13:35:09 +0000 |
commit | e8609798de7b1085a11afd33064a08ff18f77cbe (patch) | |
tree | 43da4a5a04176967c05d12b8a5ad9d5be044791b | |
parent | 1000eb18b608982d04fd4d6d27d2ea8501cb19b6 (diff) | |
download | coreutils-e8609798de7b1085a11afd33064a08ff18f77cbe.tar.xz |
(fdopendir): Don't change errno when returning non-NULL.
-rw-r--r-- | lib/openat.c | 2 |
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. */ |