Blame SOURCES/glibc-rh677316-fgets_unlocked.patch

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