Bug 4204 - [PATCH] ac printed wrong report about tty users
Summary: [PATCH] ac printed wrong report about tty users
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1997-08-01 06:40 UTC by Anatoly A. Orehovsky
Modified: 2001-08-05 10:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoly A. Orehovsky 1997-08-01 06:40:00 UTC
Running ac with it any keys result in wrong printed times for tty users.
For example: running ac -p in /etc/monthly.

Also default rotate value for wtmp (168 hours) in /etc/newsyslog.conf is not
compatible with running ac -p from /etc/monthly.

Fix: This problem is result mixed '!=' and '==' operators in ac.c(ac()).

Patch:

-- BEGIN of patch--


-- END of patch --

For remove noncompatibilty /etc/newsyslog.conf with /etc/monthly require
to move follow code from /etc/monthly:

--BEGIN of code
echo "Doing login accounting:"
ac -p | sort -nr +1
-- END of code --

to /etc/weekly.

And stay to receive "ac -p" report every week.--vARHuq7mJ4GsHd3CFZctxZJoC0oK0oPWiaG8cMNqqUxGfOnN
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

*** ac.c.orig	Fri Oct 27 06:10:10 1995
--- ac.c	Fri Aug  1 12:54:53 1997
***************
*** 506,513 ****
  			 * a login session if the ut_host field is non-empty
  			 */
  			if (*usr.ut_name) {
! 				if (strncmp(usr.ut_line, "tty", 3) != 0 ||
! 				    strchr("pqrstuvwxy", usr.ut_line[3]) == 0 ||
  				    *usr.ut_host != '\0')
  					head = log_in(head, &usr);
  			} else
--- 506,513 ----
  			 * a login session if the ut_host field is non-empty
  			 */
  			if (*usr.ut_name) {
! 				if (strncmp(usr.ut_line, "tty", 3) == 0 ||
! 				    strchr("pqrstuvwxy", usr.ut_line[3]) != 0 ||
  				    *usr.ut_host != '\0')
  					head = log_in(head, &usr);
  			} else
How-To-Repeat: 
ac -p
ac -d
...
Comment 1 Poul-Henning Kamp freebsd_committer freebsd_triage 1998-05-04 12:15:58 UTC
State Changed
From-To: open->suspended

come and get it committers! 
Comment 2 Jonathan Chen freebsd_committer freebsd_triage 2001-08-05 10:41:36 UTC
State Changed
From-To: suspended->closed

fixed committed in -CURRENT.