libc/fts: Use O_CLOEXEC for internal file descriptors
authorJohn Marino <draco@marino.st>
Thu, 15 Nov 2012 21:46:29 +0000 (22:46 +0100)
committerJohn Marino <draco@marino.st>
Thu, 15 Nov 2012 23:06:57 +0000 (00:06 +0100)
commitfc8c7a91ff2e30d25ba17d9469e9f0ac19adba26
tree98ce7e3371408e453f6419c060c96a316d2b83a8
parent7cfd531a3bf703c2ef3f01a325d0f976c2294303
libc/fts: Use O_CLOEXEC for internal file descriptors

Because fts keeps internal file descriptors open across calls, making such
descriptors close-on-exec helps not only multi-threaded applications but
also single-threaded applications.

In particular, this prevents passing a temporary file descriptor for saving
the current directory to processes created via find -exec.

Taken-from: FreeBSD SVN 241010 (27 SEP 2012)
lib/libc/gen/fts.c