Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rice!sun-spots-request From: selig@golem.msfc.nasa.gov (Bill Selig - SysAdmin) Newsgroups: comp.sys.sun Subject: source: fixes wtmp so 'last' looks ok Keywords: Source Message-ID: <3174@brazos.Rice.edu> Date: 15 Nov 89 15:48:14 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 32 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 202, message 17 of 17 About every 3-7 months here we have a case where the wtmp file gets scrod and the output of the 'last' command looks REAL WIERD. This gets caused by extra characters in the wtmp file. I have never figured out where this comes from, but I did get aggravated enough the second time it happened to write a bit of code to automatically fix the problem. I submit this to the general community in case others have been hassled by this. Usage method is: fixwtmp infile [outfile] It will read the infile, print to stdout the results of its analysis and corrections, and optionally write to an output file. I typically do 'fixwtmp /var/adm/wtmp fw >results' followed by 'last -f fw' to check out the process. If the 'last' check looks ok, I copy (as root) fw back to /var/adm/wtmp (making sure that no log{in,out}s have occured since I started). Ed's Note: placed in archives FTP Hostname : titan.rice.edu (128.42.30.1) Directory: sun-source Filename : fixwtmp.c Archive Server Address: archive-server@rice.edu Archive Server Command: get sun-source fixwtmp.c