]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix getpass fflush_unlocked namespace (bug 18540).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:14:18 +0000 (20:14 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:14:18 +0000 (20:14 +0000)
The getpass function (XPG3 / XPG4 / UNIX98) calls fflush_unlocked (not
in any of those standards).  This patch fixes this by making
fflush_unlocked into a weak alias for __fflush_unlocked and calling
__fflush_unlocked from getpass.

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

[BZ #18540]
* libio/iofflush.c [!_IO_MTSAFE_IO] (__fflush_unlocked): Define as
strong alias of _IO_fflush.  Use libc_hidden_def.
* libio/iofflush_u.c (fflush_unlocked): Rename to
__fflush_unlocked and define as weak alias of __fflush_unlocked.
Use libc_hidden_weak.
* include/stdio.h (__fflush_unlocked): Declare.  Use
libc_hidden_proto.
* misc/getpass.c (getpass): Call __fflush_unlocked instead of
fflush_unlocked.
* conform/Makefile (test-xfail-UNIX98/unistd.h/linknamespace):
Remove variable.

ChangeLog
NEWS
conform/Makefile
include/stdio.h
libio/iofflush.c
libio/iofflush_u.c
misc/getpass.c

index 2b516b6a3fd01045ea5a597ddf5278a24a581400..046b1ae27d9bcecb616c43304c5b7277677a84ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2015-06-17  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #18540]
+       * libio/iofflush.c [!_IO_MTSAFE_IO] (__fflush_unlocked): Define as
+       strong alias of _IO_fflush.  Use libc_hidden_def.
+       * libio/iofflush_u.c (fflush_unlocked): Rename to
+       __fflush_unlocked and define as weak alias of __fflush_unlocked.
+       Use libc_hidden_weak.
+       * include/stdio.h (__fflush_unlocked): Declare.  Use
+       libc_hidden_proto.
+       * misc/getpass.c (getpass): Call __fflush_unlocked instead of
+       fflush_unlocked.
+       * conform/Makefile (test-xfail-UNIX98/unistd.h/linknamespace):
+       Remove variable.
+
        [BZ #18539]
        * stdlib/fmtmsg.c (addseverity): Rename to __addseverity and
        define as weak alias of __addseverity.
diff --git a/NEWS b/NEWS
index 6f3d7d81a07df6306913ebaf753d8a2bc7f56624..17a11aba16ac290a8003c2aaacdd1e1122365e7b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,7 +22,7 @@ Version 2.22
   18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
   18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
   18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532,
-  18533, 18534, 18536, 18539.
+  18533, 18534, 18536, 18539, 18540.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 4bbc1e6cc829d831b0f8f0b3def49e513f0fe941..32d29850e2ffcf229b60bd09a513b97af7117185 100644 (file)
@@ -348,5 +348,4 @@ test-xfail-XPG3/unistd.h/linknamespace = yes
 test-xfail-XPG4/unistd.h/linknamespace = yes
 test-xfail-POSIX/mqueue.h/linknamespace = yes
 test-xfail-UNIX98/mqueue.h/linknamespace = yes
-test-xfail-UNIX98/unistd.h/linknamespace = yes
 test-xfail-UNIX98/wchar.h/linknamespace = yes
index 9cd324bfe00313c64c0d38e4d3e4ece65fb848c8..5e50e63b70ee6a1827bbe64a6182d946b03a5a55 100644 (file)
@@ -155,6 +155,8 @@ extern __typeof (ftello) __ftello;
 libc_hidden_proto (__ftello)
 libc_hidden_proto (fflush)
 libc_hidden_proto (fflush_unlocked)
+extern __typeof (fflush_unlocked) __fflush_unlocked;
+libc_hidden_proto (__fflush_unlocked)
 extern __typeof (fread_unlocked) __fread_unlocked;
 libc_hidden_proto (__fread_unlocked)
 libc_hidden_proto (fwrite_unlocked)
index 106f55fd2cb3105aab5ff13027eea4210e6ad64b..236e145a918555a504e0aba9a3953520e74c891b 100644 (file)
@@ -50,6 +50,8 @@ weak_alias (_IO_fflush, fflush)
 libc_hidden_weak (fflush)
 
 #ifndef _IO_MTSAFE_IO
+strong_alias (_IO_fflush, __fflush_unlocked)
+libc_hidden_def (__fflush_unlocked)
 weak_alias (_IO_fflush, fflush_unlocked)
 libc_hidden_weak (fflush_unlocked)
 #endif
index 6cc325a5b37894f5701a0c71e56f8a1fcafa2e06..e00447991d3018e9996d47eaf63675004bb9024a 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 int
-fflush_unlocked (fp)
+__fflush_unlocked (fp)
      _IO_FILE *fp;
 {
   if (fp == NULL)
@@ -39,4 +39,6 @@ fflush_unlocked (fp)
       return _IO_SYNC (fp) ? EOF : 0;
     }
 }
-libc_hidden_def (fflush_unlocked)
+libc_hidden_def (__fflush_unlocked)
+weak_alias (__fflush_unlocked, fflush_unlocked)
+libc_hidden_weak (fflush_unlocked)
index 36796db0c8bfd2fe5cfab430477dde89aa7f87e1..dcaff3855c4e82c1e674c31ef0f811c9a1f4afd1 100644 (file)
@@ -91,7 +91,7 @@ getpass (prompt)
 
   /* Write the prompt.  */
   __fxprintf (out, "%s", prompt);
-  fflush_unlocked (out);
+  __fflush_unlocked (out);
 
   /* Read the password.  */
   nread = __getline (&buf, &bufsize, in);