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
|
#endif
|
||||||
if (dirp) break;
|
if (dirp) break;
|
||||||
e = errno;
|
e = errno;
|
||||||
|
/* fallback */
|
||||||
|
case 0:
|
||||||
#if USE_OPENDIR_AT
|
#if USE_OPENDIR_AT
|
||||||
if (fd >= 0) close(fd);
|
if (fd >= 0) close(fd);
|
||||||
#endif
|
#endif
|
||||||
/* fallback */
|
|
||||||
case 0:
|
|
||||||
*status = 0;
|
*status = 0;
|
||||||
if (to_be_ignored(e)) break;
|
if (to_be_ignored(e)) break;
|
||||||
if (errfunc) {
|
if (errfunc) {
|
||||||
|
|
Loading…
Reference in a new issue