Date: Wed, 6 Jan 2010 19:57:38 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r201661 - user/ed/utmpx/usr.sbin/ac Message-ID: <201001061957.o06JvcVL023814@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001061957.o06JvcVL023814>