Blame SOURCES/glibc-rh677316-fgets_unlocked.patch

fa3bfd
Partial backport of:
fa3bfd
fa3bfd
commit c4eae75271734f820a7477dbce33f8752af6f003
fa3bfd
Author: Joseph Myers <joseph@codesourcery.com>
fa3bfd
Date:   Wed Nov 12 22:39:36 2014 +0000
fa3bfd
fa3bfd
    Fix __get_nprocs fgets_unlocked namespace (bug 17582).
fa3bfd
fa3bfd
(alpha part is missing)
fa3bfd
fa3bfd
diff --git a/include/stdio.h b/include/stdio.h
fa3bfd
index 53a2c58ab0c7d7be..cc1908ef0566cea9 100644
fa3bfd
--- a/include/stdio.h
fa3bfd
+++ b/include/stdio.h
fa3bfd
@@ -151,6 +151,8 @@ libc_hidden_proto (fflush_unlocked)
fa3bfd
 libc_hidden_proto (fread_unlocked)
fa3bfd
 libc_hidden_proto (fwrite_unlocked)
fa3bfd
 libc_hidden_proto (fgets_unlocked)
fa3bfd
+extern __typeof (fgets_unlocked) __fgets_unlocked;
fa3bfd
+libc_hidden_proto (__fgets_unlocked)
fa3bfd
 libc_hidden_proto (fputs_unlocked)
fa3bfd
 libc_hidden_proto (fmemopen)
fa3bfd
 libc_hidden_proto (open_memstream)
fa3bfd
diff --git a/libio/iofgets.c b/libio/iofgets.c
fa3bfd
index 984cb86103b13c0f..3621f1c00ec9ea4d 100644
fa3bfd
--- a/libio/iofgets.c
fa3bfd
+++ b/libio/iofgets.c
fa3bfd
@@ -73,6 +73,8 @@ _IO_fgets (buf, n, fp)
fa3bfd
 weak_alias (_IO_fgets, fgets)
fa3bfd
 
fa3bfd
 # ifndef _IO_MTSAFE_IO
fa3bfd
+strong_alias (_IO_fgets, __fgets_unlocked)
fa3bfd
+libc_hidden_def (__fgets_unlocked)
fa3bfd
 weak_alias (_IO_fgets, fgets_unlocked)
fa3bfd
 libc_hidden_weak (fgets_unlocked)
fa3bfd
 # endif
fa3bfd
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
fa3bfd
index e524943a54ba107a..e2cf6373b8178097 100644
fa3bfd
--- a/libio/iofgets_u.c
fa3bfd
+++ b/libio/iofgets_u.c
fa3bfd
@@ -28,7 +28,7 @@
fa3bfd
 #include <stdio.h>
fa3bfd
 
fa3bfd
 char *
fa3bfd
-fgets_unlocked (buf, n, fp)
fa3bfd
+__fgets_unlocked (buf, n, fp)
fa3bfd
      char *buf;
fa3bfd
      int n;
fa3bfd
      _IO_FILE *fp;
fa3bfd
@@ -66,4 +66,6 @@ fgets_unlocked (buf, n, fp)
fa3bfd
   fp->_IO_file_flags |= old_error;
fa3bfd
   return result;
fa3bfd
 }
fa3bfd
-libc_hidden_def (fgets_unlocked)
fa3bfd
+libc_hidden_def (__fgets_unlocked)
fa3bfd
+weak_alias (__fgets_unlocked, fgets_unlocked)
fa3bfd
+libc_hidden_weak (fgets_unlocked)
fa3bfd
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
fa3bfd
index 22285f39f33bf26c..9082b1a7ab29a9f9 100644
fa3bfd
--- a/sysdeps/unix/sysv/linux/getsysstats.c
fa3bfd
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
fa3bfd
@@ -304,7 +304,7 @@ phys_pages_info (const char *format)
fa3bfd
 	 string "processor".  We don't have to fear extremely long
fa3bfd
 	 lines since the kernel will not generate them.  8192
fa3bfd
 	 bytes are really enough.  */
fa3bfd
-      while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
fa3bfd
+      while (__fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
fa3bfd
 	if (sscanf (buffer, format, &result) == 1)
fa3bfd
 	  {
fa3bfd
 	    result /= (__getpagesize () / 1024);
fa3bfd
diff --git a/sysdeps/unix/sysv/linux/sparc/getsysstats.c b/sysdeps/unix/sysv/linux/sparc/getsysstats.c
fa3bfd
index 57d9b95223c6ab33..ceb8a2ba1f9cc9d5 100644
fa3bfd
--- a/sysdeps/unix/sysv/linux/sparc/getsysstats.c
fa3bfd
+++ b/sysdeps/unix/sysv/linux/sparc/getsysstats.c
fa3bfd
@@ -46,7 +46,7 @@
fa3bfd
 	 probed cpus.  We don't have to fear extremely long lines since	 \
fa3bfd
 	 the kernel will not generate them.  8192 bytes are really	 \
fa3bfd
 	 enough.  */							 \
fa3bfd
-      while (fgets_unlocked ((BUFFER), sizeof (BUFFER), (FP)) != NULL)	 \
fa3bfd
+      while (__fgets_unlocked ((BUFFER), sizeof (BUFFER), (FP)) != NULL) \
fa3bfd
 	if (sscanf (buffer, "ncpus probed : %d", &(RESULT)) == 1)	 \
fa3bfd
 	  break;							 \
fa3bfd
     }									 \