about summary refs log tree commit diff
path: root/io
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-05-03 16:33:26 -0700
committerRoland McGrath <roland@hack.frob.com>2013-05-03 16:33:26 -0700
commitcc0e6ed81fa3ab0eeecfc576098b4522f0323c4b (patch)
treeef84d38f2a5bba357c20eb8c3a6135c2bb6746b8 /io
parent60bfd54cbb0c51ab95c52a7438509373b848c957 (diff)
downloadglibc-cc0e6ed81fa3ab0eeecfc576098b4522f0323c4b.tar.gz
glibc-cc0e6ed81fa3ab0eeecfc576098b4522f0323c4b.tar.xz
glibc-cc0e6ed81fa3ab0eeecfc576098b4522f0323c4b.zip
Consolidate definitions of _FORTIFY_SOURCE wrappers for open{,64}{,at}.
Diffstat (limited to 'io')
-rw-r--r--io/Makefile4
-rw-r--r--io/open.c14
-rw-r--r--io/open64.c13
-rw-r--r--io/open64_2.c29
-rw-r--r--io/open_2.c29
-rw-r--r--io/openat.c14
-rw-r--r--io/openat64.c14
-rw-r--r--io/openat64_2.c29
-rw-r--r--io/openat_2.c29
9 files changed, 126 insertions, 49 deletions
diff --git a/io/Makefile b/io/Makefile
index 86453d45bc..a7a8044a88 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -36,10 +36,10 @@ routines :=								\
 	statvfs fstatvfs statvfs64 fstatvfs64				\
 	umask chmod fchmod lchmod fchmodat				\
 	mkdir mkdirat							\
-	open open64 openat openat64 close				\
+	open open_2 open64 open64_2 openat openat_2 openat64 openat64_2	\
 	read write lseek lseek64 access euidaccess faccessat		\
 	fcntl flock lockf lockf64					\
-	dup dup2 dup3 pipe pipe2					\
+	close dup dup2 dup3 pipe pipe2					\
 	creat creat64							\
 	chdir fchdir							\
 	getcwd getwd getdirname						\
diff --git a/io/open.c b/io/open.c
index 89e8a78b68..b01ba6eac5 100644
--- a/io/open.c
+++ b/io/open.c
@@ -22,7 +22,6 @@
 #include <stddef.h>
 #include <stdio.h>
 
-extern char **__libc_argv attribute_hidden;
 
 /* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
    a third argument is the file protection.  */
@@ -57,15 +56,6 @@ weak_alias (__libc_open, open)
 
 stub_warning (open)
 
-
-int
-__open_2 (file, oflag)
-     const char *file;
-     int oflag;
-{
-  if (oflag & O_CREAT)
-    __fortify_fail ("invalid open call: O_CREAT without mode");
-
-  return __open (file, oflag);
-}
+/* __open_2 is a generic wrapper that calls __open.
+   So give a stub warning for that symbol too.  */
 stub_warning (__open_2)
diff --git a/io/open64.c b/io/open64.c
index 40d2bca200..818d3819f8 100644
--- a/io/open64.c
+++ b/io/open64.c
@@ -53,15 +53,6 @@ weak_alias (__libc_open64, open64)
 
 stub_warning (open64)
 
-
-int
-__open64_2 (file, oflag)
-     const char *file;
-     int oflag;
-{
-  if (oflag & O_CREAT)
-    __fortify_fail ("invalid open64 call: O_CREAT without mode");
-
-  return __open64 (file, oflag);
-}
+/* __open64_2 is a generic wrapper that calls __open64.
+   So give a stub warning for that symbol too.  */
 stub_warning (__open64_2)
diff --git a/io/open64_2.c b/io/open64_2.c
new file mode 100644
index 0000000000..c9a83f9ff2
--- /dev/null
+++ b/io/open64_2.c
@@ -0,0 +1,29 @@
+/* _FORTIFY_SOURCE wrapper for open64.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+int
+__open64_2 (const char *file, int oflag)
+{
+  if (oflag & O_CREAT)
+    __fortify_fail ("invalid open64 call: O_CREAT without mode");
+
+  return __open64 (file, oflag);
+}
diff --git a/io/open_2.c b/io/open_2.c
new file mode 100644
index 0000000000..3b9fe28670
--- /dev/null
+++ b/io/open_2.c
@@ -0,0 +1,29 @@
+/* _FORTIFY_SOURCE wrapper for open.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+int
+__open_2 (const char *file, int oflag)
+{
+  if (oflag & O_CREAT)
+    __fortify_fail ("invalid open call: O_CREAT without mode");
+
+  return __open (file, oflag);
+}
diff --git a/io/openat.c b/io/openat.c
index 16b11916bd..3722c58236 100644
--- a/io/openat.c
+++ b/io/openat.c
@@ -75,16 +75,6 @@ libc_hidden_def (__openat)
 weak_alias (__openat, openat)
 stub_warning (openat)
 
-
-int
-__openat_2 (fd, file, oflag)
-     int fd;
-     const char *file;
-     int oflag;
-{
-  if (oflag & O_CREAT)
-    __fortify_fail ("invalid openat call: O_CREAT without mode");
-
-  return __openat (fd, file, oflag);
-}
+/* __openat_2 is a generic wrapper that calls __openat.
+   So give a stub warning for that symbol too.  */
 stub_warning (__openat_2)
diff --git a/io/openat64.c b/io/openat64.c
index fabfa5d380..506da3cf07 100644
--- a/io/openat64.c
+++ b/io/openat64.c
@@ -68,16 +68,6 @@ libc_hidden_def (__openat64)
 weak_alias (__openat64, openat64)
 stub_warning (openat64)
 
-
-int
-__openat64_2 (fd, file, oflag)
-     int fd;
-     const char *file;
-     int oflag;
-{
-  if (oflag & O_CREAT)
-    __fortify_fail ("invalid openat64 call: O_CREAT without mode");
-
-  return __openat64 (fd, file, oflag);
-}
+/* __openat64_2 is a generic wrapper that calls __openat64.
+   So give a stub warning for that symbol too.  */
 stub_warning (__openat_2)
diff --git a/io/openat64_2.c b/io/openat64_2.c
new file mode 100644
index 0000000000..e69fce41a9
--- /dev/null
+++ b/io/openat64_2.c
@@ -0,0 +1,29 @@
+/* _FORTIFY_SOURCE wrapper for openat64.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+int
+__openat64_2 (int fd, const char *file, int oflag)
+{
+  if (oflag & O_CREAT)
+    __fortify_fail ("invalid openat64 call: O_CREAT without mode");
+
+  return __openat64 (fd, file, oflag);
+}
diff --git a/io/openat_2.c b/io/openat_2.c
new file mode 100644
index 0000000000..b423f1dc6b
--- /dev/null
+++ b/io/openat_2.c
@@ -0,0 +1,29 @@
+/* _FORTIFY_SOURCE wrapper for openat.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+int
+__openat_2 (int fd, const char *file, int oflag)
+{
+  if (oflag & O_CREAT)
+    __fortify_fail ("invalid openat call: O_CREAT without mode");
+
+  return __openat (fd, file, oflag);
+}