From d4499cba41d3390131bf1c9252f104859f337496 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Wed, 26 Sep 2012 13:47:46 +0200 Subject: [PATCH] libc_noux: return the new file descriptor in 'dup2()' Fixes #369. --- ports/src/lib/libc_noux/plugin.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/src/lib/libc_noux/plugin.cc b/ports/src/lib/libc_noux/plugin.cc index 033228cba0..722f894d64 100644 --- a/ports/src/lib/libc_noux/plugin.cc +++ b/ports/src/lib/libc_noux/plugin.cc @@ -972,7 +972,7 @@ namespace { return -1; } - return 0; + return noux_fd(new_fd->context); } @@ -1034,7 +1034,7 @@ namespace { * Use new allocated number as name of file descriptor * duplicate. */ - if (dup2(fd, new_fd)) { + if (dup2(fd, new_fd) == -1) { PERR("Plugin::fcntl: dup2 unexpectedly failed"); errno = EINVAL; return -1;