From f31ffa6b8aa940bea5b13953697bc214ccd7bf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 26 Nov 2009 16:38:54 +0000 Subject: [PATCH] * Use O_CLOEXEC when open directories, attribute directories, indexes, and queries. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34291 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/vfs.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 2197b45d33..38ffdc4cc5 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -5133,8 +5133,8 @@ open_dir_vnode(struct vnode* vnode, bool kernel) if (status != B_OK) return status; - // file is opened, create a fd - status = get_new_fd(FDTYPE_DIR, NULL, vnode, cookie, 0, kernel); + // directory is opened, create a fd + status = get_new_fd(FDTYPE_DIR, NULL, vnode, cookie, O_CLOEXEC, kernel); if (status >= 0) return status; @@ -5159,11 +5159,11 @@ open_attr_dir_vnode(struct vnode* vnode, bool kernel) return EOPNOTSUPP; status = FS_CALL(vnode, open_attr_dir, &cookie); - if (status < 0) + if (status != B_OK) return status; - // file is opened, create a fd - status = get_new_fd(FDTYPE_ATTR_DIR, NULL, vnode, cookie, 0, kernel); + // directory is opened, create a fd + status = get_new_fd(FDTYPE_ATTR_DIR, NULL, vnode, cookie, O_CLOEXEC, kernel); if (status >= 0) return status; @@ -6610,7 +6610,7 @@ index_dir_open(dev_t mountID, bool kernel) // get fd for the index directory int fd; - fd = get_new_fd(FDTYPE_INDEX_DIR, mount, NULL, cookie, 0, kernel); + fd = get_new_fd(FDTYPE_INDEX_DIR, mount, NULL, cookie, O_CLOEXEC, kernel); if (fd >= 0) return fd; @@ -6813,7 +6813,7 @@ query_open(dev_t device, const char* query, uint32 flags, port_id port, // get fd for the index directory int fd; - fd = get_new_fd(FDTYPE_QUERY, mount, NULL, cookie, 0, kernel); + fd = get_new_fd(FDTYPE_QUERY, mount, NULL, cookie, O_CLOEXEC, kernel); if (fd >= 0) return fd;