diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2006-10-03 02:29:15 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2006-10-03 02:29:15 +0000 |
commit | 07706ccde7070f5695b2b92d66775c561609d513 (patch) | |
tree | af304b32d349a8c0b463b93ae7195840aee5eda8 /lib/libpthread | |
parent | 2701db09a71daf730aa4e2da0ed592a141683f35 (diff) |
upon success dup2() returns newfd so don't overwrite it with
_thread_fd_table_init()'s return value and blow it away. fixes
firefox plugin problem noticed by jolan@
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_dup2.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_dup2.c b/lib/libpthread/uthread/uthread_dup2.c index ea1b88c7c5e..0ed5578686f 100644 --- a/lib/libpthread/uthread/uthread_dup2.c +++ b/lib/libpthread/uthread/uthread_dup2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_dup2.c,v 1.9 2006/09/26 14:18:28 kurt Exp $ */ +/* $OpenBSD: uthread_dup2.c,v 1.10 2006/10/03 02:29:14 kurt Exp $ */ /* PUBLIC DOMAIN <marc@snafu.org> */ #include <errno.h> @@ -25,8 +25,9 @@ dup2(int fd, int newfd) _thread_fs_flags_replace(newfd, NULL); ret = _thread_sys_dup2(fd, newfd); if (ret != -1) - ret = _thread_fd_table_init(newfd, FD_INIT_DUP2, - _thread_fd_table[fd]->status_flags); + if(_thread_fd_table_init(newfd, FD_INIT_DUP2, + _thread_fd_table[fd]->status_flags) == -1) + ret = -1; /* * If the dup2 or the _thread_fd_table_init |