about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-05-12 10:53:04 +0800
committerThomas Schwinge <thomas@codesourcery.com>2012-05-12 10:53:04 +0800
commitdc70356cbfc649af8e39c9a8d509fefd766fa8ef (patch)
tree1183fe5797332d424dd803f36c1ebda53ebe7324
parent9fb1a21f4d33c4c82719d6130e149eb2c5a51ae8 (diff)
downloadglibc-dc70356cbfc649af8e39c9a8d509fefd766fa8ef.tar.gz
glibc-dc70356cbfc649af8e39c9a8d509fefd766fa8ef.tar.xz
glibc-dc70356cbfc649af8e39c9a8d509fefd766fa8ef.zip
Avoid dup3 PLT usage.
Fixes fallout from 5aa3a74a59916b489e9cf7c4dce9eb149e106c6c.
-rw-r--r--ChangeLog7
-rw-r--r--io/dup3.c5
-rw-r--r--libio/freopen.c6
-rw-r--r--libio/freopen64.c6
-rw-r--r--sysdeps/unix/syscalls.list2
5 files changed, 17 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c4a814167..8a10d6ab09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-05-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* io/dup3.c (dup3): Rename to __dup3, add weak alias for dup3.
+	* sysdeps/unix/syscalls.list (dup3): Likewise.
+	* libio/freopen.c (freopen): Invoke __dup3 instead of dup3.
+	* libio/freopen64.c (freopen64): Invoke __dup3 instead of dup3.
+
 2012-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf/stackguard-macros.h (STACK_CHK_GUARD) [__x86_64__]: Use
diff --git a/io/dup3.c b/io/dup3.c
index 90a3d60898..7e97bf733c 100644
--- a/io/dup3.c
+++ b/io/dup3.c
@@ -24,7 +24,7 @@
    open the same file as FD is which setting flags according to
    FLAGS.  Return FD2 or -1.  */
 int
-dup3 (fd, fd2, flags)
+__dup3 (fd, fd2, flags)
      int fd;
      int fd2;
      int flags;
@@ -42,7 +42,8 @@ dup3 (fd, fd2, flags)
   __set_errno (ENOSYS);
   return -1;
 }
-libc_hidden_def (dup3)
+libc_hidden_def (__dup3)
+weak_alias (__dup3, dup3)
 stub_warning (dup3)
 
 #include <stub-tag.h>
diff --git a/libio/freopen.c b/libio/freopen.c
index 025c55b655..fa89c277c6 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -89,9 +89,9 @@ freopen (filename, mode, fp)
 	  else
 	    newfd =
 # endif
-	      dup3 (_IO_fileno (result), fd,
-		    (result->_flags2 & _IO_FLAGS2_CLOEXEC) != 0
-		    ? O_CLOEXEC : 0);
+	      __dup3 (_IO_fileno (result), fd,
+                      (result->_flags2 & _IO_FLAGS2_CLOEXEC) != 0
+                      ? O_CLOEXEC : 0);
 #else
 # define newfd 1
 #endif
diff --git a/libio/freopen64.c b/libio/freopen64.c
index 24d0360625..c28a9925f0 100644
--- a/libio/freopen64.c
+++ b/libio/freopen64.c
@@ -73,9 +73,9 @@ freopen64 (filename, mode, fp)
 	  else
 	    newfd =
 # endif
-	      dup3 (_IO_fileno (result), fd,
-		    (result->_flags2 & _IO_FLAGS2_CLOEXEC) != 0
-		    ? O_CLOEXEC : 0);
+	      __dup3 (_IO_fileno (result), fd,
+                      (result->_flags2 & _IO_FLAGS2_CLOEXEC) != 0
+                      ? O_CLOEXEC : 0);
 #else
 # define newfd 1
 #endif
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 5c696b31cb..39c40ed7f6 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -10,7 +10,7 @@ chroot		-	chroot		i:s	chroot
 close		-	close		Ci:i	__libc_close	__close close
 dup		-	dup		i:i	__dup		dup
 dup2		-	dup2		i:ii	__dup2		dup2
-dup3		-	dup3		i:iii	dup3
+dup3		-	dup3		i:iii	__dup3		dup3
 fchdir		-	fchdir		i:i	__fchdir	fchdir
 fchmod		-	fchmod		i:ii	__fchmod	fchmod
 fchown		-	fchown		i:iii	__fchown	fchown