arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1330705-3.patch

147e83
commit cc0e6ed81fa3ab0eeecfc576098b4522f0323c4b
147e83
Author: Roland McGrath <roland@hack.frob.com>
147e83
Date:   Fri May 3 16:33:26 2013 -0700
147e83
147e83
    Consolidate definitions of _FORTIFY_SOURCE wrappers for open{,64}{,at}.
147e83
147e83
Index: b/io/Makefile
147e83
===================================================================
147e83
--- a/io/Makefile
147e83
+++ b/io/Makefile
147e83
@@ -36,10 +36,10 @@ routines :=								\
147e83
 	statvfs fstatvfs statvfs64 fstatvfs64				\
147e83
 	umask chmod fchmod lchmod fchmodat				\
147e83
 	mkdir mkdirat							\
147e83
-	open open64 openat openat64 close				\
147e83
+	open open_2 open64 open64_2 openat openat_2 openat64 openat64_2	\
147e83
 	read write lseek lseek64 access euidaccess faccessat		\
147e83
 	fcntl flock lockf lockf64					\
147e83
-	dup dup2 dup3 pipe pipe2					\
147e83
+	close dup dup2 dup3 pipe pipe2					\
147e83
 	creat creat64							\
147e83
 	chdir fchdir							\
147e83
 	getcwd getwd getdirname						\
147e83
Index: b/io/open.c
147e83
===================================================================
147e83
--- a/io/open.c
147e83
+++ b/io/open.c
147e83
@@ -22,7 +22,6 @@
147e83
 #include <stddef.h>
147e83
 #include <stdio.h>
147e83
 
147e83
-extern char **__libc_argv attribute_hidden;
147e83
 
147e83
 /* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
147e83
    a third argument is the file protection.  */
147e83
@@ -57,15 +56,6 @@ weak_alias (__libc_open, open)
147e83
 
147e83
 stub_warning (open)
147e83
 
147e83
-
147e83
-int
147e83
-__open_2 (file, oflag)
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid open call: O_CREAT without mode");
147e83
-
147e83
-  return __open (file, oflag);
147e83
-}
147e83
+/* __open_2 is a generic wrapper that calls __open.
147e83
+   So give a stub warning for that symbol too.  */
147e83
 stub_warning (__open_2)
147e83
Index: b/io/open64.c
147e83
===================================================================
147e83
--- a/io/open64.c
147e83
+++ b/io/open64.c
147e83
@@ -54,15 +54,6 @@ weak_alias (__libc_open64, open64)
147e83
 
147e83
 stub_warning (open64)
147e83
 
147e83
-
147e83
-int
147e83
-__open64_2 (file, oflag)
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid open64 call: O_CREAT without mode");
147e83
-
147e83
-  return __open64 (file, oflag);
147e83
-}
147e83
+/* __open64_2 is a generic wrapper that calls __open64.
147e83
+   So give a stub warning for that symbol too.  */
147e83
 stub_warning (__open64_2)
147e83
Index: b/io/open64_2.c
147e83
===================================================================
147e83
--- /dev/null
147e83
+++ b/io/open64_2.c
147e83
@@ -0,0 +1,29 @@
147e83
+/* _FORTIFY_SOURCE wrapper for open64.
147e83
+   Copyright (C) 2013 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
+#include <fcntl.h>
147e83
+#include <stdio.h>
147e83
+
147e83
+int
147e83
+__open64_2 (const char *file, int oflag)
147e83
+{
147e83
+  if (oflag & O_CREAT)
147e83
+    __fortify_fail ("invalid open64 call: O_CREAT without mode");
147e83
+
147e83
+  return __open64 (file, oflag);
147e83
+}
147e83
Index: b/io/open_2.c
147e83
===================================================================
147e83
--- /dev/null
147e83
+++ b/io/open_2.c
147e83
@@ -0,0 +1,29 @@
147e83
+/* _FORTIFY_SOURCE wrapper for open.
147e83
+   Copyright (C) 2013 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
+#include <fcntl.h>
147e83
+#include <stdio.h>
147e83
+
147e83
+int
147e83
+__open_2 (const char *file, int oflag)
147e83
+{
147e83
+  if (oflag & O_CREAT)
147e83
+    __fortify_fail ("invalid open call: O_CREAT without mode");
147e83
+
147e83
+  return __open (file, oflag);
147e83
+}
147e83
Index: b/io/openat.c
147e83
===================================================================
147e83
--- a/io/openat.c
147e83
+++ b/io/openat.c
147e83
@@ -75,16 +75,6 @@ libc_hidden_def (__openat)
147e83
 weak_alias (__openat, openat)
147e83
 stub_warning (openat)
147e83
 
147e83
-
147e83
-int
147e83
-__openat_2 (fd, file, oflag)
147e83
-     int fd;
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid openat call: O_CREAT without mode");
147e83
-
147e83
-  return __openat (fd, file, oflag);
147e83
-}
147e83
+/* __openat_2 is a generic wrapper that calls __openat.
147e83
+   So give a stub warning for that symbol too.  */
147e83
 stub_warning (__openat_2)
147e83
Index: b/io/openat64.c
147e83
===================================================================
147e83
--- a/io/openat64.c
147e83
+++ b/io/openat64.c
147e83
@@ -68,16 +68,6 @@ libc_hidden_def (__openat64)
147e83
 weak_alias (__openat64, openat64)
147e83
 stub_warning (openat64)
147e83
 
147e83
-
147e83
-int
147e83
-__openat64_2 (fd, file, oflag)
147e83
-     int fd;
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid openat64 call: O_CREAT without mode");
147e83
-
147e83
-  return __openat64 (fd, file, oflag);
147e83
-}
147e83
+/* __openat64_2 is a generic wrapper that calls __openat64.
147e83
+   So give a stub warning for that symbol too.  */
147e83
 stub_warning (__openat_2)
147e83
Index: b/io/openat64_2.c
147e83
===================================================================
147e83
--- /dev/null
147e83
+++ b/io/openat64_2.c
147e83
@@ -0,0 +1,29 @@
147e83
+/* _FORTIFY_SOURCE wrapper for openat64.
147e83
+   Copyright (C) 2013 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
+#include <fcntl.h>
147e83
+#include <stdio.h>
147e83
+
147e83
+int
147e83
+__openat64_2 (int fd, const char *file, int oflag)
147e83
+{
147e83
+  if (oflag & O_CREAT)
147e83
+    __fortify_fail ("invalid openat64 call: O_CREAT without mode");
147e83
+
147e83
+  return __openat64 (fd, file, oflag);
147e83
+}
147e83
Index: b/io/openat_2.c
147e83
===================================================================
147e83
--- /dev/null
147e83
+++ b/io/openat_2.c
147e83
@@ -0,0 +1,29 @@
147e83
+/* _FORTIFY_SOURCE wrapper for openat.
147e83
+   Copyright (C) 2013 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
+#include <fcntl.h>
147e83
+#include <stdio.h>
147e83
+
147e83
+int
147e83
+__openat_2 (int fd, const char *file, int oflag)
147e83
+{
147e83
+  if (oflag & O_CREAT)
147e83
+    __fortify_fail ("invalid openat call: O_CREAT without mode");
147e83
+
147e83
+  return __openat (fd, file, oflag);
147e83
+}
147e83
Index: b/sysdeps/mach/hurd/open.c
147e83
===================================================================
147e83
--- a/sysdeps/mach/hurd/open.c
147e83
+++ b/sysdeps/mach/hurd/open.c
147e83
@@ -52,20 +52,9 @@ weak_alias (__libc_open, __open)
147e83
 libc_hidden_weak (__open)
147e83
 weak_alias (__libc_open, open)
147e83
 
147e83
-int
147e83
-__open_2 (file, oflag)
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid open call: O_CREAT without mode");
147e83
-
147e83
-  return __open (file, oflag);
147e83
-}
147e83
 
147e83
 /* open64 is just the same as open for us.  */
147e83
 weak_alias (__libc_open, __libc_open64)
147e83
 weak_alias (__libc_open, __open64)
147e83
 libc_hidden_weak (_open64)
147e83
 weak_alias (__libc_open, open64)
147e83
-strong_alias (__open_2, __open64_2)
147e83
Index: b/sysdeps/mach/hurd/openat.c
147e83
===================================================================
147e83
--- a/sysdeps/mach/hurd/openat.c
147e83
+++ b/sysdeps/mach/hurd/openat.c
147e83
@@ -56,20 +56,7 @@ __openat (fd, file, oflag)
147e83
 libc_hidden_def (__openat)
147e83
 weak_alias (__openat, openat)
147e83
 
147e83
-int
147e83
-__openat_2 (fd, file, oflag)
147e83
-     int fd;
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid openat call: O_CREAT without mode");
147e83
-
147e83
-  return __openat (fd, file, oflag);
147e83
-}
147e83
-
147e83
 /* openat64 is just the same as openat for us.  */
147e83
 weak_alias (__openat, __openat64)
147e83
 libc_hidden_weak (__openat64)
147e83
 weak_alias (__openat, openat64)
147e83
-strong_alias (__openat_2, __openat64_2)
147e83
Index: b/sysdeps/unix/sysv/linux/Makefile
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/Makefile
147e83
+++ b/sysdeps/unix/sysv/linux/Makefile
147e83
@@ -158,7 +158,7 @@ endif
147e83
 
147e83
 ifeq ($(subdir),io)
147e83
 sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
147e83
-		   sync_file_range open_2 open64_2 fallocate fallocate64
147e83
+		   sync_file_range fallocate fallocate64
147e83
 sysdep_headers += bits/fcntl-linux.h
147e83
 endif
147e83
 
147e83
Index: b/sysdeps/unix/sysv/linux/open64_2.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/open64_2.c
147e83
+++ /dev/null
147e83
@@ -1,31 +0,0 @@
147e83
-/* Copyright (C) 2007 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include <fcntl.h>
147e83
-#include <stdio.h>
147e83
-
147e83
-
147e83
-int
147e83
-__open64_2 (file, oflag)
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid open64 call: O_CREAT without mode");
147e83
-
147e83
-  return __open64 (file, oflag);
147e83
-}
147e83
Index: b/sysdeps/unix/sysv/linux/open_2.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/open_2.c
147e83
+++ /dev/null
147e83
@@ -1,31 +0,0 @@
147e83
-/* Copyright (C) 2007 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include <fcntl.h>
147e83
-#include <stdio.h>
147e83
-
147e83
-
147e83
-int
147e83
-__open_2 (file, oflag)
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-    __fortify_fail ("invalid open call: O_CREAT without mode");
147e83
-
147e83
-  return __open (file, oflag);
147e83
-}
147e83
Index: b/sysdeps/unix/sysv/linux/openat.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/openat.c
147e83
+++ b/sysdeps/unix/sysv/linux/openat.c
147e83
@@ -29,7 +29,6 @@
147e83
 
147e83
 #ifndef OPENAT
147e83
 # define OPENAT openat
147e83
-# define __OPENAT_2 __openat_2
147e83
 
147e83
 # ifndef __ASSUME_ATFCTS
147e83
 /* Set errno after a failed call.  If BUF is not null,
147e83
@@ -179,18 +178,3 @@ __OPENAT (fd, file, oflag)
147e83
 }
147e83
 libc_hidden_def (__OPENAT)
147e83
 weak_alias (__OPENAT, OPENAT)
147e83
-
147e83
-
147e83
-int
147e83
-__OPENAT_2 (fd, file, oflag)
147e83
-     int fd;
147e83
-     const char *file;
147e83
-     int oflag;
147e83
-{
147e83
-  if (oflag & O_CREAT)
147e83
-#define MSG(s) MSG2 (s)
147e83
-#define MSG2(s) "invalid " #s " call: O_CREAT without mode"
147e83
-    __fortify_fail (MSG (OPENAT));
147e83
-
147e83
-  return __OPENAT (fd, file, oflag);
147e83
-}
147e83
Index: b/sysdeps/unix/sysv/linux/openat64.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/openat64.c
147e83
+++ b/sysdeps/unix/sysv/linux/openat64.c
147e83
@@ -1,5 +1,4 @@
147e83
 #define OPENAT openat64
147e83
-#define __OPENAT_2 __openat64_2
147e83
 #define MORE_OFLAGS O_LARGEFILE
147e83
 
147e83
 #include "openat.c"
147e83
Index: b/sysdeps/unix/sysv/linux/wordsize-64/openat.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/wordsize-64/openat.c
147e83
+++ b/sysdeps/unix/sysv/linux/wordsize-64/openat.c
147e83
@@ -1,16 +1,14 @@
147e83
 #define __openat64 __rename___openat64
147e83
-#define __openat64_2 __rename___openat64_2
147e83
 #define __openat64_nocancel __rename___openat64_nocancel
147e83
 #define openat64 __rename_openat64
147e83
 
147e83
 #include "../openat.c"
147e83
 
147e83
 #undef __openat64
147e83
-#undef __openat64_2
147e83
 #undef __openat64_nocancel
147e83
 #undef openat64
147e83
 
147e83
-weak_alias (__openat, __openat64)
147e83
-weak_alias (__openat_2, __openat64_2)
147e83
-weak_alias (__openat_nocancel, __openat64_nocancel)
147e83
+strong_alias (__openat, __openat64)
147e83
+hidden_ver (__openat, __openat64)
147e83
+strong_alias (__openat_nocancel, __openat64_nocancel)
147e83
 weak_alias (openat, openat64)