diff options
author | ache <ache@FreeBSD.org> | 1997-04-21 13:52:29 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-04-21 13:52:29 +0000 |
commit | 8d94879c4ea32d6827c0516ccf15138fd901992f (patch) | |
tree | d407f912743cd44e0f41ad9ff008957fcf8a3220 /contrib/top | |
parent | 3cb2cde67df7279f0ec376cb9605e6996880c109 (diff) | |
download | FreeBSD-src-8d94879c4ea32d6827c0516ccf15138fd901992f.zip FreeBSD-src-8d94879c4ea32d6827c0516ccf15138fd901992f.tar.gz |
Use UT_NAMESIZE instead of hardcoded user names length
Diffstat (limited to 'contrib/top')
-rw-r--r-- | contrib/top/username.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/top/username.c b/contrib/top/username.c index 4a98a2b..dbead50 100644 --- a/contrib/top/username.c +++ b/contrib/top/username.c @@ -30,13 +30,14 @@ #include <stdio.h> #include <pwd.h> +#include <utmp.h> #include "top.local.h" #include "utils.h" struct hash_el { int uid; - char name[9]; + char name[UT_NAMESIZE + 1]; }; #define is_empty_hash(x) (hash_table[x].name[0] == 0) @@ -125,7 +126,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, 8); + (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE); return(hashindex); } |