aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-01 19:49:20 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-01 19:49:20 +0000
commit9b7d96458175a852f71700922ca2950577b95f27 (patch)
tree623a992e90290849c3a260e2a18983504f6ed47e
parentf378fced43edd9c4ae4a31117b74f467dcd75f01 (diff)
downloadbusybox-w32-9b7d96458175a852f71700922ca2950577b95f27.tar.gz
busybox-w32-9b7d96458175a852f71700922ca2950577b95f27.tar.bz2
busybox-w32-9b7d96458175a852f71700922ca2950577b95f27.zip
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
-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 8b4279d87..fade2e249 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
44then create a microLibc to provide these functions. There is no good reason 44then create a microLibc to provide these functions. There is no good reason
45for GNU libc to be so big. I'm sure it can be a lot better. 45for GNU libc to be so big. I'm sure it can be a lot better.
46 46
47(BTW, this is more informative if BB_FEATURE_NFSMOUNT is turned off...)
48
47 49
48----------------------- 50-----------------------
49 51
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 182f40ed2..bde1752ba 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
29 29
30extern int logname_main(int argc, char **argv) 30extern int logname_main(int argc, char **argv)
31{ 31{
32 char *cp; 32 char *user = xmalloc(9);
33 33
34 if (argc > 1) 34 if (argc > 1)
35 usage(logname_usage); 35 usage(logname_usage);
36 36
37 cp = getlogin(); 37 my_getpwuid(user, geteuid());
38 if (cp) { 38 if (user) {
39 puts(cp); 39 puts(user);
40 exit(TRUE); 40 exit(TRUE);
41 } 41 }
42 fprintf(stderr, "%s: no login name\n", argv[0]); 42 fprintf(stderr, "no login name\n");
43 exit(FALSE); 43 exit(FALSE);
44} 44}
diff --git a/logname.c b/logname.c
index 182f40ed2..bde1752ba 100644
--- a/logname.c
+++ b/logname.c
@@ -29,16 +29,16 @@ static const char logname_usage[] = "logname\n\n"
29 29
30extern int logname_main(int argc, char **argv) 30extern int logname_main(int argc, char **argv)
31{ 31{
32 char *cp; 32 char *user = xmalloc(9);
33 33
34 if (argc > 1) 34 if (argc > 1)
35 usage(logname_usage); 35 usage(logname_usage);
36 36
37 cp = getlogin(); 37 my_getpwuid(user, geteuid());
38 if (cp) { 38 if (user) {
39 puts(cp); 39 puts(user);
40 exit(TRUE); 40 exit(TRUE);
41 } 41 }
42 fprintf(stderr, "%s: no login name\n", argv[0]); 42 fprintf(stderr, "no login name\n");
43 exit(FALSE); 43 exit(FALSE);
44} 44}