From: Jim Meyering Date: Sun, 30 Mar 2003 15:02:55 +0000 (+0000) Subject: (is_empty_dir): Don't let a failing closedir X-Git-Tag: COREUTILS-5_0~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb726ef20bacbea366079fb7af54245061a270bc;p=platform%2Fupstream%2Fcoreutils.git (is_empty_dir): Don't let a failing closedir clobber errno. Spotted by Arnold Robbins. --- diff --git a/src/remove.c b/src/remove.c index a0ad0a124..21c5ac0ac 100644 --- a/src/remove.c +++ b/src/remove.c @@ -527,8 +527,9 @@ is_empty_dir (char const *dir) dp = readdir (dirp); if (dp == NULL) { + int saved_errno = errno; closedir (dirp); - return errno == 0 ? true : false; + return saved_errno == 0 ? true : false; } f = dp->d_name;