mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
015d05c6e6
commit
1dec75c02f
1 changed files with 2 additions and 2 deletions
4
dir.c
4
dir.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue