From ccb73f8bf9191c01c90975958a210c47175bd98c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 26 Jul 2014 13:27:07 -0500 Subject: Default xcreate/xopen to O_CLOEXEC. (Pass O_CLOEXEC in the flags to switch it back off.) This way we're not leaking filehandles to children from things like find -exec. --- lib/dirtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dirtree.c') diff --git a/lib/dirtree.c b/lib/dirtree.c index 85b1a3cf..7ad699e1 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -115,7 +115,7 @@ struct dirtree *dirtree_handle_callback(struct dirtree *new, if (dir) { if (flags & (DIRTREE_RECURSE|DIRTREE_COMEAGAIN)) { - new->data = openat(dirtree_parentfd(new), new->name, 0); + new->data = openat(dirtree_parentfd(new), new->name, O_CLOEXEC); dirtree_recurse(new, callback, flags & DIRTREE_SYMFOLLOW); if (flags & DIRTREE_COMEAGAIN) flags = callback(new); } -- cgit v1.2.3