summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorkurt <kurt@openbsd.org>2006-10-03 02:29:14 +0000
committerkurt <kurt@openbsd.org>2006-10-03 02:29:14 +0000
commit69f1c87258052c516d24d6c501a326858e194799 (patch)
treeb3ced60b0a0fbde609232a7bf9601d837fd536b7 /lib/libpthread/uthread
parentDon't load bad144 bad sector information into disklabels for archs that (diff)
downloadwireguard-openbsd-69f1c87258052c516d24d6c501a326858e194799.tar.xz
wireguard-openbsd-69f1c87258052c516d24d6c501a326858e194799.zip
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/uthread')
-rw-r--r--lib/libpthread/uthread/uthread_dup2.c7
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