svn commit: r201661 - user/ed/utmpx/usr.sbin/ac

Ed Schouten ed at FreeBSD.org
Wed Jan 6 19:57:39 UTC 2010


Author: ed
Date: Wed Jan  6 19:57:38 2010
New Revision: 201661
URL: http://svn.freebsd.org/changeset/base/201661

Log:
  Make ac(8) work with utmpx.
  
  For DEAD_PROCESS entries we should always just compare ut_id's.
  DEAD_PROCESS entries don't have a user name nor a TTY device.

Modified:
  user/ed/utmpx/usr.sbin/ac/ac.c

Modified: user/ed/utmpx/usr.sbin/ac/ac.c
==============================================================================
--- user/ed/utmpx/usr.sbin/ac/ac.c	Wed Jan  6 19:29:18 2010	(r201660)
+++ user/ed/utmpx/usr.sbin/ac/ac.c	Wed Jan  6 19:57:38 2010	(r201661)
@@ -378,7 +378,8 @@ log_out(struct utmp_list *head, struct u
 
 	for (lp = head, lp2 = NULL; lp != NULL; )
 		if (up->ut_type == BOOT_TIME || up->ut_type == SHUTDOWN_TIME ||
-		    strcmp(lp->usr.ut_line, up->ut_line) == 0) {
+		    (up->ut_type == DEAD_PROCESS &&
+		    strcmp(lp->usr.ut_id, up->ut_id) == 0)) {
 			secs = up->ut_tv.tv_sec - lp->usr.ut_tv.tv_sec;
 			Users = update_user(Users, lp->usr.ut_user, secs);
 #ifdef DEBUG
@@ -553,6 +554,7 @@ ac(const char *file)
 			for (lp = head; lp != NULL; lp = lp->next)
 				lp->usr.ut_tv.tv_sec -= secs;
 			break;
+		case BOOT_TIME:
 		case SHUTDOWN_TIME:
 			head = log_out(head, usr);
 			FirstTime = ut_timecopy; /* shouldn't be needed */


More information about the svn-src-user mailing list