svn commit: r202104 - user/ed/utmpx/usr.sbin/ac
Ed Schouten
ed at FreeBSD.org
Mon Jan 11 19:10:30 UTC 2010
Author: ed
Date: Mon Jan 11 19:10:29 2010
New Revision: 202104
URL: http://svn.freebsd.org/changeset/base/202104
Log:
Enable the code to shut down sessions at the end properly.
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 Mon Jan 11 19:04:24 2010 (r202103)
+++ user/ed/utmpx/usr.sbin/ac/ac.c Mon Jan 11 19:10:29 2010 (r202104)
@@ -477,7 +477,7 @@ int
ac(const char *file)
{
struct utmp_list *lp, *head = NULL;
- struct utmpx *usr;
+ struct utmpx *usr, usht;
struct tm *ltm;
time_t prev_secs, secs, ut_timecopy;
int day, rfound, tchanged, tskipped;
@@ -581,32 +581,28 @@ ac(const char *file)
}
}
endutxent();
-#if 0
- if (usr != NULL) {
- if (!(Flags & AC_W))
- usr->ut_tv.tv_sec = time(NULL);
- usr->ut_type = SHUTDOWN_TIME;
-
- if (Flags & AC_D) {
- ut_timecopy = usr->ut_tv.tv_sec;
- ltm = localtime(&ut_timecopy);
- if (day >= 0 && day != ltm->tm_yday) {
- /*
- * print yesterday's total
- */
- secs = ut_timecopy;
- secs -= ltm->tm_sec;
- secs -= 60 * ltm->tm_min;
- secs -= 3600 * ltm->tm_hour;
- show_today(Users, head, secs);
- }
+ if (!(Flags & AC_W))
+ usht.ut_tv.tv_sec = time(NULL);
+ usht.ut_type = SHUTDOWN_TIME;
+
+ if (Flags & AC_D) {
+ ut_timecopy = usht.ut_tv.tv_sec;
+ ltm = localtime(&ut_timecopy);
+ if (day >= 0 && day != ltm->tm_yday) {
+ /*
+ * print yesterday's total
+ */
+ secs = ut_timecopy;
+ secs -= ltm->tm_sec;
+ secs -= 60 * ltm->tm_min;
+ secs -= 3600 * ltm->tm_hour;
+ show_today(Users, head, secs);
}
- /*
- * anyone still logged in gets time up to now
- */
- head = log_out(head, usr);
}
-#endif
+ /*
+ * anyone still logged in gets time up to now
+ */
+ head = log_out(head, &usht);
if (Flags & AC_D)
show_today(Users, head, time((time_t *)0));
More information about the svn-src-user
mailing list