From e8609798de7b1085a11afd33064a08ff18f77cbe Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 23 Nov 2005 13:35:09 +0000 Subject: [PATCH] (fdopendir): Don't change errno when returning non-NULL. --- lib/openat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openat.c b/lib/openat.c index 2300208f80..1bd4d73c82 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. */ -- 2.47.3