My little adventure of analyzing lib usage has already rooted out
a big "P" Policy violator -- logname was using getlogin(3), which uses utmp under the hood. We don't need no stinkin' utmp (and if we are using tinylogin, it is unlikely to be useful trying). -Erik
This commit is contained in:
parent
f378fced43
commit
9b7d964581
2
TODO
2
TODO
@ -44,6 +44,8 @@ It would be a very nice thing to reduce this list to an absolute minimum, and
|
|||||||
then create a microLibc to provide these functions. There is no good reason
|
then create a microLibc to provide these functions. There is no good reason
|
||||||
for GNU libc to be so big. I'm sure it can be a lot better.
|
for GNU libc to be so big. I'm sure it can be a lot better.
|
||||||
|
|
||||||
|
(BTW, this is more informative if BB_FEATURE_NFSMOUNT is turned off...)
|
||||||
|
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
|
|||||||
|
|
||||||
extern int logname_main(int argc, char **argv)
|
extern int logname_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *user = xmalloc(9);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
usage(logname_usage);
|
usage(logname_usage);
|
||||||
|
|
||||||
cp = getlogin();
|
my_getpwuid(user, geteuid());
|
||||||
if (cp) {
|
if (user) {
|
||||||
puts(cp);
|
puts(user);
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "%s: no login name\n", argv[0]);
|
fprintf(stderr, "no login name\n");
|
||||||
exit(FALSE);
|
exit(FALSE);
|
||||||
}
|
}
|
||||||
|
10
logname.c
10
logname.c
@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
|
|||||||
|
|
||||||
extern int logname_main(int argc, char **argv)
|
extern int logname_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *user = xmalloc(9);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
usage(logname_usage);
|
usage(logname_usage);
|
||||||
|
|
||||||
cp = getlogin();
|
my_getpwuid(user, geteuid());
|
||||||
if (cp) {
|
if (user) {
|
||||||
puts(cp);
|
puts(user);
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "%s: no login name\n", argv[0]);
|
fprintf(stderr, "no login name\n");
|
||||||
exit(FALSE);
|
exit(FALSE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user