aboutsummaryrefslogtreecommitdiff
path: root/contrib/top
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-04-21 13:52:29 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-04-21 13:52:29 +0000
commit447e1358b60016b29c0824176d3247dccb34ab32 (patch)
tree714e804258620358e7a5a1bd3d3c9fba5d1058ce /contrib/top
parent1642d921656c3b200673f69786bc737abedc193d (diff)
downloadsrc-447e1358b60016b29c0824176d3247dccb34ab32.tar.gz
src-447e1358b60016b29c0824176d3247dccb34ab32.zip
Use UT_NAMESIZE instead of hardcoded user names length
Notes
Notes: svn path=/head/; revision=25076
Diffstat (limited to 'contrib/top')
-rw-r--r--contrib/top/username.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/top/username.c b/contrib/top/username.c
index 4a98a2bfc973..dbead50d7267 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);
}