From: Jan Klemkow Subject: newsyslog: fix time and size logic To: tech@openbsd.org Date: Mon, 9 Sep 2024 13:05:14 +0200 Hi, if we use time and size parameter for logfile rotation, just the time parameter is used. Caused by the return next to the debug print (see below). If we removed the return statement, the logic changed to (time || size). The manpage is also adjusted to clarify this behavior. ok? bye, Jan Index: newsyslog.8 =================================================================== RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.8,v diff -u -p -r1.55 newsyslog.8 --- newsyslog.8 22 Apr 2024 14:16:14 -0000 1.55 +++ newsyslog.8 3 Sep 2024 21:25:35 -0000 @@ -253,6 +253,14 @@ If an interval is specified, the log fil many hours have passed since the last rotation. When both a time and an interval are specified, both conditions must be satisfied for the rotation to take place. +If the +.Ar size +field is set and not +.Ql * +or +.Ql 0 , +the file will be rotated either if the size is +exceeded or the specified time or interval is reached. .Pp There is no provision for the specification of a time zone. There is little point in specifying an explicit minutes or seconds Index: newsyslog.c =================================================================== RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v diff -u -p -r1.114 newsyslog.c --- newsyslog.c 22 Apr 2024 14:20:35 -0000 1.114 +++ newsyslog.c 3 Sep 2024 21:25:35 -0000 @@ -313,7 +313,6 @@ do_entry(struct conf_entry *ent) difftime(timenow, ent->trim_at) >= 60 * 60) { DPRINTF(("--> will trim at %s", ctime(&ent->trim_at))); - return; } else if (ent->hours <= 0) { DPRINTF(("--> time is up\n")); }