bin/100018: newsyslog(8) does not check size if time_at is used
gavin at FreeBSD.org
gavin at FreeBSD.org
Thu Jul 17 12:11:37 UTC 2008
Synopsis: newsyslog(8) does not check size if time_at is used
State-Changed-From-To: open->feedback
State-Changed-By: gavin
State-Changed-When: Thu Jul 17 11:22:53 UTC 2008
State-Changed-Why:
To submitter: Can you try the following patch please?
It works for me, and I've been running it on a couple of machines for a few
weeks without problem, but more testers would be beneficial!
Index: src/usr.sbin/newsyslog/newsyslog.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/newsyslog/newsyslog.c,v
retrieving revision 1.108
diff -u -r1.108 newsyslog.c
--- src/usr.sbin/newsyslog/newsyslog.c 30 Jan 2008 22:11:59 -0000 1.108
+++ src/usr.sbin/newsyslog/newsyslog.c 17 Jul 2008 12:06:53 -0000
@@ -424,11 +424,13 @@
{
#define REASON_MAX 80
int modtime;
+ int check_time_rotate;
fk_entry free_or_keep;
double diffsecs;
char temp_reason[REASON_MAX];
free_or_keep = FREE_ENT;
+ check_time_rotate = 0;
if (verbose) {
if (ent->flags & CE_COMPACT)
printf("%s <%dZ>: ", ent->log, ent->numlogs);
@@ -476,7 +478,6 @@
printf("--> will trim at %s",
ptimeget_ctime(ent->trim_at));
}
- return (free_or_keep);
} else if (diffsecs >= 3600.0) {
/*
* trim_at is more than an hour in the past,
@@ -491,7 +492,6 @@
printf("--> will trim at %s",
ptimeget_ctime(ent->trim_at));
}
- return (free_or_keep);
} else if (verbose && noaction && dbg_at_times) {
/*
* If we are just debugging at-times, then
@@ -501,9 +501,10 @@
*/
printf("\n\t--> timematch at %s",
ptimeget_ctime(ent->trim_at));
- return (free_or_keep);
- } else if (verbose && ent->hours <= 0) {
- printf("--> time is up\n");
+ } else if (ent->hours <= 0) {
+ if (verbose)
+ printf("--> time is up\n");
+ check_time_rotate = 1;
}
}
if (verbose && (ent->trsize > 0))
@@ -526,7 +527,8 @@
ent->rotate = 1;
snprintf(temp_reason, REASON_MAX, " due to size>%dK",
ent->trsize);
- } else if (ent->hours <= 0 && (ent->flags & CE_TRIMAT)) {
+ } else if ((ent->hours <= 0 && (ent->flags & CE_TRIMAT)) &&
+ check_time_rotate) {
ent->rotate = 1;
} else if ((ent->hours > 0) && ((modtime >= ent->hours) ||
(modtime < 0))) {
Responsible-Changed-From-To: freebsd-bugs->gavin
Responsible-Changed-By: gavin
Responsible-Changed-When: Thu Jul 17 11:22:53 UTC 2008
Responsible-Changed-Why:
Track
http://www.freebsd.org/cgi/query-pr.cgi?pr=100018
More information about the freebsd-bugs
mailing list