unix: implement uv_disable_stdio_inheritance()

This commit is contained in:
Ben Noordhuis 2012-06-14 01:19:56 +02:00 committed by Bert Belder
parent ade6930241
commit 4d7f1e1864

View File

@ -587,6 +587,14 @@ uv_err_t uv_chdir(const char* dir) {
void uv_disable_stdio_inheritance(void) {
int fd;
/* Set the CLOEXEC flag on all open descriptors. Unconditionally try the
* first 16 file descriptors. After that, bail out after the first error.
*/
for (fd = 0; ; fd++)
if (uv__cloexec(fd, 1) && fd > 15)
break;
}