diff options
Diffstat (limited to 'lib/libpthread/uthread/uthread_dup.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_dup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_dup.c b/lib/libpthread/uthread/uthread_dup.c index 9ca6343043a..7b7d01c3069 100644 --- a/lib/libpthread/uthread/uthread_dup.c +++ b/lib/libpthread/uthread/uthread_dup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_dup.c,v 1.5 2003/02/05 05:51:51 marc Exp $ */ +/* $OpenBSD: uthread_dup.c,v 1.6 2006/09/22 19:04:33 kurt Exp $ */ /* PUBLIC DOMAIN <marc@snafu.org> */ #include <unistd.h> @@ -14,11 +14,13 @@ dup(int fd) ret = _FD_LOCK(fd, FD_RDWR, NULL); if (ret == 0) { ret = _thread_sys_dup(fd); - if (ret != -1) - if (_thread_fd_table_dup(fd, ret) == -1) { - close(ret); + if (ret != -1) { + if (_thread_fd_table_init(ret, + _thread_fd_table[fd]->status_flags) == -1) { + _thread_sys_close(ret); ret = -1; } + } _FD_UNLOCK(fd, FD_RDWR); } return (ret); |