1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Use UT_NAMESIZE instead of hardcoded user names length

This commit is contained in:
Andrey A. Chernov 1997-04-21 13:52:29 +00:00
parent 1642d92165
commit 447e1358b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25076

View File

@ -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);
}