summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--coreutils/logname.c10
-rw-r--r--logname.c10
3 files changed, 12 insertions, 10 deletions
diff --git a/TODO b/TODO
index 8b4279d..fade2e2 100644
--- a/TODO
+++ b/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
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...)
+
-----------------------
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 182f40e..bde1752 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
extern int logname_main(int argc, char **argv)
{
- char *cp;
+ char *user = xmalloc(9);
if (argc > 1)
usage(logname_usage);
- cp = getlogin();
- if (cp) {
- puts(cp);
+ my_getpwuid(user, geteuid());
+ if (user) {
+ puts(user);
exit(TRUE);
}
- fprintf(stderr, "%s: no login name\n", argv[0]);
+ fprintf(stderr, "no login name\n");
exit(FALSE);
}
diff --git a/logname.c b/logname.c
index 182f40e..bde1752 100644
--- a/logname.c
+++ b/logname.c
@@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
extern int logname_main(int argc, char **argv)
{
- char *cp;
+ char *user = xmalloc(9);
if (argc > 1)
usage(logname_usage);
- cp = getlogin();
- if (cp) {
- puts(cp);
+ my_getpwuid(user, geteuid());
+ if (user) {
+ puts(user);
exit(TRUE);
}
- fprintf(stderr, "%s: no login name\n", argv[0]);
+ fprintf(stderr, "no login name\n");
exit(FALSE);
}