Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
The maximum user login length should have nothing to do with <utmp.h>.
This commit is contained in:
parent
f45946a8f7
commit
2d86428bba
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user