mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Fix ttyslot namespace (bug 18547).
ttyslot (XPG4) calls the non-XPG4 functions endttyent, getttyent and setttyent, which in turn bring in references to fgets_unlocked and getttynam. This patch fixes this by making these functions into weak aliases and calling the __* names as needed. Tested for x86_64 and x86 (testsuite, and that disassembly of installed stripped shared libraries is unchanged by the patch). [BZ #18547] * misc/getttyent.c (getttynam): Rename to __getttynam and define as weak alias of __getttynam. Use prototype function definition. Call __setttyent, __getttyent and __endttyent instead of setttyent, getttyent and endttyent. (getttyent): Rename to __getttyent and define as weak alias of __getttyent. Call __setttyent instead of setttyent. Call __fgets_unlocked instead of fgets_unlocked. (setttyent): Rename to __setttyent and define as weak alias of __setttyent. (endttyent): Rename to __endttyent and define as weak alias of __endttyent. * include/ttyent.h (__getttyent): Declare. Use libc_hidden_proto. (__setttyent): Likewise. (__endttyent): Likewise. (getttyent): Don't use libc_hidden_proto. (setttyent): Likewise. (endttyent): Likewise. * misc/ttyslot.c (ttyslot): Call __setttyent, __getttyent and __endttyent instead of setttyent, getttyent and endttyent. * conform/Makefile (test-xfail-XPG4/unistd.h/linknamespace): Remove variable.
This commit is contained in:
23
ChangeLog
23
ChangeLog
@ -1,5 +1,28 @@
|
|||||||
2015-06-17 Joseph Myers <joseph@codesourcery.com>
|
2015-06-17 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
[BZ #18547]
|
||||||
|
* misc/getttyent.c (getttynam): Rename to __getttynam and define
|
||||||
|
as weak alias of __getttynam. Use prototype function definition.
|
||||||
|
Call __setttyent, __getttyent and __endttyent instead of
|
||||||
|
setttyent, getttyent and endttyent.
|
||||||
|
(getttyent): Rename to __getttyent and define as weak alias of
|
||||||
|
__getttyent. Call __setttyent instead of setttyent. Call
|
||||||
|
__fgets_unlocked instead of fgets_unlocked.
|
||||||
|
(setttyent): Rename to __setttyent and define as weak alias of
|
||||||
|
__setttyent.
|
||||||
|
(endttyent): Rename to __endttyent and define as weak alias of
|
||||||
|
__endttyent.
|
||||||
|
* include/ttyent.h (__getttyent): Declare. Use libc_hidden_proto.
|
||||||
|
(__setttyent): Likewise.
|
||||||
|
(__endttyent): Likewise.
|
||||||
|
(getttyent): Don't use libc_hidden_proto.
|
||||||
|
(setttyent): Likewise.
|
||||||
|
(endttyent): Likewise.
|
||||||
|
* misc/ttyslot.c (ttyslot): Call __setttyent, __getttyent and
|
||||||
|
__endttyent instead of setttyent, getttyent and endttyent.
|
||||||
|
* conform/Makefile (test-xfail-XPG4/unistd.h/linknamespace):
|
||||||
|
Remove variable.
|
||||||
|
|
||||||
[BZ #18546]
|
[BZ #18546]
|
||||||
* socket/recv.c (__recv): Use libc_hidden_def.
|
* socket/recv.c (__recv): Use libc_hidden_def.
|
||||||
* socket/socket.c (__socket): Likewise.
|
* socket/socket.c (__socket): Likewise.
|
||||||
|
2
NEWS
2
NEWS
@ -22,7 +22,7 @@ Version 2.22
|
|||||||
18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
|
18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
|
||||||
18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
|
18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
|
||||||
18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532,
|
18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532,
|
||||||
18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546.
|
18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546, 18547.
|
||||||
|
|
||||||
* Cache information can be queried via sysconf() function on s390 e.g. with
|
* Cache information can be queried via sysconf() function on s390 e.g. with
|
||||||
_SC_LEVEL1_ICACHE_SIZE as argument.
|
_SC_LEVEL1_ICACHE_SIZE as argument.
|
||||||
|
@ -345,4 +345,3 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
|
|||||||
|
|
||||||
# Unsorted expected failures.
|
# Unsorted expected failures.
|
||||||
test-xfail-XPG3/unistd.h/linknamespace = yes
|
test-xfail-XPG3/unistd.h/linknamespace = yes
|
||||||
test-xfail-XPG4/unistd.h/linknamespace = yes
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#ifndef _TTYENT_H
|
#ifndef _TTYENT_H
|
||||||
# include <misc/ttyent.h>
|
# include <misc/ttyent.h>
|
||||||
|
|
||||||
libc_hidden_proto (getttyent)
|
extern __typeof (getttyent) __getttyent __THROW;
|
||||||
libc_hidden_proto (setttyent)
|
libc_hidden_proto (__getttyent)
|
||||||
libc_hidden_proto (endttyent)
|
extern __typeof (setttyent) __setttyent __THROW;
|
||||||
|
libc_hidden_proto (__setttyent)
|
||||||
|
extern __typeof (endttyent) __endttyent __THROW;
|
||||||
|
libc_hidden_proto (__endttyent)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,24 +44,24 @@ static char zapchar;
|
|||||||
static FILE *tf;
|
static FILE *tf;
|
||||||
|
|
||||||
struct ttyent *
|
struct ttyent *
|
||||||
getttynam(tty)
|
__getttynam (const char *tty)
|
||||||
const char *tty;
|
|
||||||
{
|
{
|
||||||
struct ttyent *t;
|
struct ttyent *t;
|
||||||
|
|
||||||
setttyent();
|
__setttyent();
|
||||||
while ((t = getttyent()))
|
while ((t = __getttyent()))
|
||||||
if (!strcmp(tty, t->ty_name))
|
if (!strcmp(tty, t->ty_name))
|
||||||
break;
|
break;
|
||||||
endttyent();
|
__endttyent();
|
||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
weak_alias (__getttynam, getttynam)
|
||||||
|
|
||||||
static char *skip (char *) __THROW internal_function;
|
static char *skip (char *) __THROW internal_function;
|
||||||
static char *value (char *) __THROW internal_function;
|
static char *value (char *) __THROW internal_function;
|
||||||
|
|
||||||
struct ttyent *
|
struct ttyent *
|
||||||
getttyent (void)
|
__getttyent (void)
|
||||||
{
|
{
|
||||||
static struct ttyent tty;
|
static struct ttyent tty;
|
||||||
int c;
|
int c;
|
||||||
@ -69,11 +69,11 @@ getttyent (void)
|
|||||||
#define MAXLINELENGTH 100
|
#define MAXLINELENGTH 100
|
||||||
static char line[MAXLINELENGTH];
|
static char line[MAXLINELENGTH];
|
||||||
|
|
||||||
if (!tf && !setttyent())
|
if (!tf && !__setttyent())
|
||||||
return (NULL);
|
return (NULL);
|
||||||
flockfile (tf);
|
flockfile (tf);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!fgets_unlocked(p = line, sizeof(line), tf)) {
|
if (!__fgets_unlocked(p = line, sizeof(line), tf)) {
|
||||||
funlockfile (tf);
|
funlockfile (tf);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -131,7 +131,8 @@ getttyent (void)
|
|||||||
*p = '\0';
|
*p = '\0';
|
||||||
return (&tty);
|
return (&tty);
|
||||||
}
|
}
|
||||||
libc_hidden_def (getttyent)
|
libc_hidden_def (__getttyent)
|
||||||
|
weak_alias (__getttyent, getttyent)
|
||||||
|
|
||||||
#define QUOTED 1
|
#define QUOTED 1
|
||||||
|
|
||||||
@ -184,7 +185,7 @@ value(p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
setttyent (void)
|
__setttyent (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tf) {
|
if (tf) {
|
||||||
@ -197,10 +198,11 @@ setttyent (void)
|
|||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
libc_hidden_def (setttyent)
|
libc_hidden_def (__setttyent)
|
||||||
|
weak_alias (__setttyent, setttyent)
|
||||||
|
|
||||||
int
|
int
|
||||||
endttyent (void)
|
__endttyent (void)
|
||||||
{
|
{
|
||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
@ -211,4 +213,5 @@ endttyent (void)
|
|||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
libc_hidden_def (endttyent)
|
libc_hidden_def (__endttyent)
|
||||||
|
weak_alias (__endttyent, endttyent)
|
||||||
|
@ -53,20 +53,20 @@ ttyslot (void)
|
|||||||
|
|
||||||
name = __alloca (buflen);
|
name = __alloca (buflen);
|
||||||
|
|
||||||
setttyent();
|
__setttyent();
|
||||||
for (cnt = 0; cnt < 3; ++cnt)
|
for (cnt = 0; cnt < 3; ++cnt)
|
||||||
if (__ttyname_r (cnt, name, buflen) == 0) {
|
if (__ttyname_r (cnt, name, buflen) == 0) {
|
||||||
if ((p = rindex(name, '/')))
|
if ((p = rindex(name, '/')))
|
||||||
++p;
|
++p;
|
||||||
else
|
else
|
||||||
p = name;
|
p = name;
|
||||||
for (slot = 1; (ttyp = getttyent()); ++slot)
|
for (slot = 1; (ttyp = __getttyent()); ++slot)
|
||||||
if (!strcmp(ttyp->ty_name, p)) {
|
if (!strcmp(ttyp->ty_name, p)) {
|
||||||
endttyent();
|
__endttyent();
|
||||||
return(slot);
|
return(slot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
endttyent();
|
__endttyent();
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user