diff options
author | ed <ed@FreeBSD.org> | 2009-12-25 09:02:41 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-12-25 09:02:41 +0000 |
commit | 8f467b7b0fb7665857883a1c1cff3f12a49f5e46 (patch) | |
tree | 86f34e29211a7298583cda6288a3b17f10b89af0 /contrib/top | |
parent | 55d116bf0efa0a417bb0af51448bd7b35506ac03 (diff) | |
download | FreeBSD-src-8f467b7b0fb7665857883a1c1cff3f12a49f5e46.zip FreeBSD-src-8f467b7b0fb7665857883a1c1cff3f12a49f5e46.tar.gz |
Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
The maximum user login length should have nothing to do with <utmp.h>.
Diffstat (limited to 'contrib/top')
-rw-r--r-- | contrib/top/username.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/top/username.c b/contrib/top/username.c index 2359186..77f1517 100644 --- a/contrib/top/username.c +++ b/contrib/top/username.c @@ -30,17 +30,17 @@ * This makes the table size independent of the passwd file size. */ +#include <sys/param.h> #include <sys/types.h> #include <stdio.h> #include <pwd.h> -#include <utmp.h> #include "top.local.h" #include "utils.h" struct hash_el { int uid; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; }; #define is_empty_hash(x) (hash_table[x].name[0] == 0) @@ -129,7 +129,7 @@ int wecare; /* 1 = enter it always, 0 = nice to have */ /* empty or wrong slot -- fill it with new value */ hash_table[hashindex].uid = uid; - (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE); + (void) strncpy(hash_table[hashindex].name, name, MAXLOGNAME - 1); return(hashindex); } |