diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2003-10-22 00:24:15 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2003-10-22 00:24:15 +0000 |
commit | 5195883faed308e230f35a32d876751c910922ce (patch) | |
tree | c77c27b78a551ae6fb19c0800580b5f9b98e8272 /lib/libpthread/uthread | |
parent | 13e0065983caec2d9ff5a9f59f3dba4a2569a510 (diff) |
When about to do an execve(), don't bother resetting the O_NONBLOCK flag
on any file descriptors that have the close-on-exec flag set.
from FreeBSD
ok marc@
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_execve.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_execve.c b/lib/libpthread/uthread/uthread_execve.c index d6b9c8116b5..e5df58d97f3 100644 --- a/lib/libpthread/uthread/uthread_execve.c +++ b/lib/libpthread/uthread/uthread_execve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_execve.c,v 1.6 2001/08/21 19:24:53 fgsch Exp $ */ +/* $OpenBSD: uthread_execve.c,v 1.7 2003/10/22 00:24:14 brad Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -69,6 +69,10 @@ execve(const char *name, char *const * argv, char *const * envp) /* Check if this file descriptor is in use: */ if (_thread_fd_table[i] != NULL && !(_thread_fd_table[i]->flags & O_NONBLOCK)) { + /* Skip if the close-on-exec flag is set */ + flags = _thread_sys_fcntl(i, F_GETFD, NULL); + if ((flags & FD_CLOEXEC) != 0) + continue; /* don't bother, no point */ /* Get the current flags: */ flags = _thread_sys_fcntl(i, F_GETFL, NULL); /* Clear the nonblocking file descriptor flag: */ |