diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-27 01:04:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-27 01:04:23 +0000 |
commit | 3dd31324eee17f80a9a4104dcd6537b1169fc321 (patch) | |
tree | eb43c3e576de586e2a1b4db325296a99e2c0690f /dir.c | |
parent | a68946a094b50ad27e4e44c63c477d941eb3b305 (diff) | |
download | ruby-3dd31324eee17f80a9a4104dcd6537b1169fc321.tar.gz |
dir.c: fix FD leaks
* dir.c (do_opendir): close FD when fdopendir failed, e.g.,
ENOTDIR. [Feature#13056]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1372,11 +1372,11 @@ do_opendir(const int basefd, const char *path, int flags, rb_encoding *enc, #endif if (dirp) break; e = errno; + /* fallback */ + case 0: #if USE_OPENDIR_AT if (fd >= 0) close(fd); #endif - /* fallback */ - case 0: *status = 0; if (to_be_ignored(e)) break; if (errfunc) { |