diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-07-22 15:27:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-07-22 15:27:53 +0000 |
commit | 532779f9e9776926ab7dfc9dde8afa3461366518 (patch) | |
tree | f40d5fb83cf26b5071d789ea4afccee7726940bd /usr.bin | |
parent | b854200df909f0d9319e52042a745db5aaaea3f6 (diff) |
enter_user() is only called in one way, rendering the third parameter
useless; from mark@cyodesigns.com
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/top/username.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/usr.bin/top/username.c b/usr.bin/top/username.c index a08a8593519..286ea343445 100644 --- a/usr.bin/top/username.c +++ b/usr.bin/top/username.c @@ -1,4 +1,4 @@ -/* $OpenBSD: username.c,v 1.15 2008/04/02 16:41:24 deraadt Exp $ */ +/* $OpenBSD: username.c,v 1.16 2009/07/22 15:27:52 deraadt Exp $ */ /* * Top users/processes display for Unix @@ -61,7 +61,7 @@ struct hash_el { char name[_PW_NAME_LEN + 1]; }; -static int enter_user(uid_t, char *, int); +static int enter_user(uid_t, char *); static int get_user(uid_t); #define is_empty_hash(x) (hash_table[x].name[0] == 0) @@ -99,29 +99,24 @@ userid(char *username) return ((uid_t)-1); /* enter the result in the hash table */ - enter_user(pwd->pw_uid, username, 1); + enter_user(pwd->pw_uid, username); /* return our result */ return (pwd->pw_uid); } -/* - * wecare: 1 = enter it always, 0 = nice to have - */ static int -enter_user(uid_t uid, char *name, int wecare) +enter_user(uid_t uid, char *name) { int hashindex; #ifdef DEBUG - fprintf(stderr, "enter_hash(%u, %s, %d)\n", uid, name, wecare); + fprintf(stderr, "enter_hash(%u, %s)\n", uid, name); #endif hashindex = hashit(uid); if (!is_empty_hash(hashindex)) { - if (!wecare) - return 0; /* Don't clobber a slot for trash */ if (hash_table[hashindex].uid == uid) return (hashindex); /* Fortuitous find */ } @@ -142,8 +137,8 @@ get_user(uid_t uid) /* no performance penalty for using getpwuid makes it easy */ if ((pwd = getpwuid(uid)) != NULL) - return (enter_user(pwd->pw_uid, pwd->pw_name, 1)); + return (enter_user(pwd->pw_uid, pwd->pw_name)); /* if we can't find the name at all, then use the uid as the name */ - return (enter_user(uid, format_uid(uid), 1)); + return (enter_user(uid, format_uid(uid))); } |