From 7c7d47d2369881f8ea22da34077459771276786a Mon Sep 17 00:00:00 2001 From: normal Date: Wed, 10 Jan 2018 01:07:27 +0000 Subject: dir.c: pass flags to openat(2) correctly Flags are 3rd argument of openat(2) while the 4th argument (mode_t) is unnecessary for our uses. This bug exists since Ruby 2.5 from r58860 and was discoverd by strace. * dir.c (nogvl_opendir_at): use openat correctly [Feature #13056] [Feature #14346] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index ecc2eeb8ad..91680d29d7 100644 --- a/dir.c +++ b/dir.c @@ -1447,7 +1447,7 @@ nogvl_opendir_at(void *ptr) O_DIRECTORY| # endif /* O_DIRECTORY */ 0); - int fd = openat(oaa->basefd, oaa->path, 0, opendir_flags); + int fd = openat(oaa->basefd, oaa->path, opendir_flags); dirp = fd >= 0 ? fdopendir(fd) : 0; if (!dirp) { @@ -1455,7 +1455,7 @@ nogvl_opendir_at(void *ptr) switch (gc_for_fd_with_gvl(e)) { default: - if (fd < 0) fd = openat(oaa->basefd, oaa->path, 0, opendir_flags); + if (fd < 0) fd = openat(oaa->basefd, oaa->path, opendir_flags); if (fd >= 0) dirp = fdopendir(fd); if (dirp) return dirp; -- cgit v1.2.3