diff options
Diffstat (limited to 'otherlibs/win32unix/dup.c')
-rw-r--r-- | otherlibs/win32unix/dup.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/otherlibs/win32unix/dup.c b/otherlibs/win32unix/dup.c index f65a4e0c4..de2ea7449 100644 --- a/otherlibs/win32unix/dup.c +++ b/otherlibs/win32unix/dup.c @@ -19,12 +19,16 @@ CAMLprim value unix_dup(value fd) { HANDLE newh; + value newfd; + int kind = Descr_kind_val(fd); if (! DuplicateHandle(GetCurrentProcess(), Handle_val(fd), GetCurrentProcess(), &newh, 0L, TRUE, DUPLICATE_SAME_ACCESS)) { win32_maperr(GetLastError()); return -1; } - return win_alloc_handle(newh); + newfd = win_alloc_handle(newh); + Descr_kind_val(newfd) = kind; + return newfd; } |