svn commit: r200979 - head/contrib/top

Ed Schouten ed at FreeBSD.org
Fri Dec 25 09:02:42 UTC 2009


Author: ed
Date: Fri Dec 25 09:02:41 2009
New Revision: 200979
URL: http://svn.freebsd.org/changeset/base/200979

Log:
  Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
  
  The maximum user login length should have nothing to do with <utmp.h>.

Modified:
  head/contrib/top/username.c

Modified: head/contrib/top/username.c
==============================================================================
--- head/contrib/top/username.c	Fri Dec 25 08:06:35 2009	(r200978)
+++ head/contrib/top/username.c	Fri Dec 25 09:02:41 2009	(r200979)
@@ -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 =
 
     /* 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);
 }
 


More information about the svn-src-head mailing list