[PATCH 16/46] dup2: Use dup3 if arch does not have the dup2 syscall

Markos Chandras markos.chandras at gmail.com
Tue Nov 13 11:31:25 UTC 2012


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/dup2.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c
index 006f06b..e58105d 100644
--- a/libc/sysdeps/linux/common/dup2.c
+++ b/libc/sysdeps/linux/common/dup2.c
@@ -10,6 +10,12 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-
+#if defined(__NR_dup3) && ! defined(__NR_dup2)
+int dup2(int old, int newfd)
+{
+	return dup3(old, newfd, 0);
+}
+#else
 _syscall2(int, dup2, int, oldfd, int, newfd)
+#endif
 libc_hidden_def(dup2)
-- 
1.7.1




More information about the uClibc mailing list