Blame SOURCES/glibc-rh677316-fgets_unlocked.patch

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