about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/getsysstats.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-12 22:39:36 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-12 22:39:36 +0000
commitc4eae75271734f820a7477dbce33f8752af6f003 (patch)
treec909cac6bbda2c97e0003221ecd656cc668deb11 /sysdeps/unix/sysv/linux/getsysstats.c
parent01cad84e1996a6f20bf19609d0554c73f2ee33d5 (diff)
downloadglibc-c4eae75271734f820a7477dbce33f8752af6f003.tar.gz
glibc-c4eae75271734f820a7477dbce33f8752af6f003.tar.xz
glibc-c4eae75271734f820a7477dbce33f8752af6f003.zip
Fix __get_nprocs fgets_unlocked namespace (bug 17582).
__get_nprocs is called from malloc code, but calls fgets_unlocked,
which is not an ISO C or POSIX function.  This patch fixes it to call
a new __fgets_unlocked name instead.

Note: there are various other uses of fgets_unlocked in glibc's
libraries, and I haven't yet investigated which others might also be
problematic (called directly or indirectly from standard functions)
and so need to change to use __fgets_unlocked.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17582]
	* libio/iofgets.c [weak_alias && !_IO_MTSAFE_IO]
	(__fgets_unlocked): Add alias of _IO_fgets.  Use libc_hidden_def.
	* libio/iofgets_u.c (fgets_unlocked): Rename to __fgets_unlocked
	and define as weak alias of __fgets_unlocked.  Use
	libc_hidden_weak.
	(__fgets_unlocked): Use libc_hidden_def.
	* include/stdio.h (__fgets_unlocked): Declare.  Use
	libc_hidden_proto.
	* sysdeps/unix/sysv/linux/getsysstats.c (phys_pages_info): Use
	__fgets_unlocked instead of fgets_unlocked.
	* sysdeps/unix/sysv/linux/alpha/getsysstats.c
	(GET_NPROCS_CONF_PARSER): Likewise.
	* sysdeps/unix/sysv/linux/sparc/getsysstats.c
	(GET_NPROCS_CONF_PARSER): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/getsysstats.c')
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 1746827e9e..5b277e4928 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -299,7 +299,7 @@ phys_pages_info (const char *format)
 	 string "processor".  We don't have to fear extremely long
 	 lines since the kernel will not generate them.  8192
 	 bytes are really enough.  */
-      while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
+      while (__fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
 	if (sscanf (buffer, format, &result) == 1)
 	  {
 	    result /= (__getpagesize () / 1024);