Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Dec 2009 09:02:42 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200979 - head/contrib/top
Message-ID:  <200912250902.nBP92gSW055301@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912250902.nBP92gSW055301>