summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/uthread_dup2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_dup2.c b/lib/libc_r/uthread/uthread_dup2.c
index 6e8195b..af0e32a 100644
--- a/lib/libc_r/uthread/uthread_dup2.c
+++ b/lib/libc_r/uthread/uthread_dup2.c
@@ -45,7 +45,8 @@ _dup2(int fd, int newfd)
int newfd_opened;
/* Check if the file descriptor is out of range: */
- if (newfd < 0 || newfd >= _thread_dtablesize) {
+ if (newfd < 0 || newfd >= _thread_dtablesize ||
+ newfd == _thread_kern_pipe[0] || newfd == _thread_kern_pipe[1]) {
/* Return a bad file descriptor error: */
errno = EBADF;
ret = -1;
OpenPOWER on IntegriCloud