aboutsummaryrefslogtreecommitdiff
path: root/contrib/top
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-12-25 09:02:41 +0000
committerEd Schouten <ed@FreeBSD.org>2009-12-25 09:02:41 +0000
commit2d86428bbad45cf55f3016c5786c94e400306f9f (patch)
tree86f34e29211a7298583cda6288a3b17f10b89af0 /contrib/top
parentf45946a8f7850219e52eadecd6d294d2adf82523 (diff)
downloadsrc-2d86428bbad45cf55f3016c5786c94e400306f9f.tar.gz
src-2d86428bbad45cf55f3016c5786c94e400306f9f.zip
Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
The maximum user login length should have nothing to do with <utmp.h>.
Notes
Notes: svn path=/head/; revision=200979
Diffstat (limited to 'contrib/top')
-rw-r--r--contrib/top/username.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/top/username.c b/contrib/top/username.c
index 23591866eb83..77f1517b706d 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);
}