newsyslog - Fix an old bug in newsyslog
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Sun, 28 Jan 2018 18:21:48 +0000 (19:21 +0100)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Sun, 28 Jan 2018 20:31:54 +0000 (21:31 +0100)
commit6b053813114f6f2145bab34925c977658184b234
treebc75aacc4d01a023f758d8605c82a473caecdd9b
parent1f53ee67e68e273cdad57aea161eb71066b4505c
newsyslog - Fix an old bug in newsyslog

We kept one log file more than was requested in newsyslog.conf.
This was only the case using the non-time based filenames (.0, .1,
.2 etc.).

The change also makes newsyslog clean clean up the old extra logfile
so users don't end up with a single stale logfile which won't be
rotated out.

This change also cleans up some code a bit to avoid more copy / paste
code and removes some old copy / paste code in the process.

Obtained-from: FreeBSD (r220926)
usr.sbin/newsyslog/newsyslog.c