diff options
author | 2007-04-07 14:08:46 +0000 | |
---|---|---|
committer | 2007-04-07 14:08:46 +0000 | |
commit | 900299e97295a1ab7c471092fce81c27b0825263 (patch) | |
tree | 3ed4a44c5f2c616e977c0a40ed434e7f1dc6ce16 /lib/libpthread/uthread | |
parent | Use pci_matchbyid() rather than handrolled equivalent. From Brad. (diff) | |
download | wireguard-openbsd-900299e97295a1ab7c471092fce81c27b0825263.tar.xz wireguard-openbsd-900299e97295a1ab7c471092fce81c27b0825263.zip |
Upon fork() set the child's view of the stored file status flags inherited
from the parent to all non-blocking. This prevents the child from restoring
the file to be blocking upon close() and causing the parent to deadlock
when it later attempts to utilize the blocking fd. Corrects the netbeans
build failure caused by the jdk forkAndExec() function that replaces the
std fd's before execvp(). okay marc@
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_fork.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_fork.c b/lib/libpthread/uthread/uthread_fork.c index f3a0230e632..ea6a92c985b 100644 --- a/lib/libpthread/uthread/uthread_fork.c +++ b/lib/libpthread/uthread/uthread_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_fork.c,v 1.14 2006/09/26 14:18:28 kurt Exp $ */ +/* $OpenBSD: uthread_fork.c,v 1.15 2007/04/07 14:08:46 kurt Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -185,8 +185,11 @@ fork(void) _thread_fd_table[i]->w_lineno = 0; _thread_fd_table[i]->r_lockcount = 0; _thread_fd_table[i]->w_lockcount = 0; - if (_thread_fd_table[i]->status_flags != NULL) + if (_thread_fd_table[i]->status_flags != NULL) { _SPINLOCK_INIT(&_thread_fd_table[i]->status_flags->lock); + /* make sure child doesn't set fd to blocking upon close */ + _thread_fd_table[i]->status_flags->flags |= O_NONBLOCK; + } /* * If a fd was in the process of closing * then finish closing it. |