From owner-svn-src-head@FreeBSD.ORG Wed Mar 21 06:51:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCF961065673; Wed, 21 Mar 2012 06:51:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C85B68FC17; Wed, 21 Mar 2012 06:51:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2L6pjWM058276; Wed, 21 Mar 2012 06:51:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2L6pjpG058274; Wed, 21 Mar 2012 06:51:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201203210651.q2L6pjpG058274@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 21 Mar 2012 06:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233257 - head/usr.sbin/newsyslog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 06:51:46 -0000 Author: glebius Date: Wed Mar 21 06:51:45 2012 New Revision: 233257 URL: http://svn.freebsd.org/changeset/base/233257 Log: Don't run through time checks when entry is definitely oversized. This leads to newsyslog rotating on (size OR time) if both are specified. PR: 100018, 160432 Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Wed Mar 21 04:00:58 2012 (r233256) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Mar 21 06:51:45 2012 (r233257) @@ -484,12 +484,14 @@ do_entry(struct conf_entry * ent) fk_entry free_or_keep; double diffsecs; char temp_reason[REASON_MAX]; + int oversized; free_or_keep = FREE_ENT; if (verbose) printf("%s <%d%s>: ", ent->log, ent->numlogs, compress_type[ent->compress].flag); ent->fsize = sizefile(ent->log); + oversized = ((ent->trsize > 0) && (ent->fsize >= ent->trsize)); modtime = age_old_log(ent->log); ent->rotate = 0; ent->firstcreate = 0; @@ -518,7 +520,8 @@ do_entry(struct conf_entry * ent) printf("does not exist, skipped%s.\n", temp_reason); } } else { - if (ent->flags & CE_TRIMAT && !force && !rotatereq) { + if (ent->flags & CE_TRIMAT && !force && !rotatereq && + !oversized) { diffsecs = ptimeget_diff(timenow, ent->trim_at); if (diffsecs < 0.0) { /* trim_at is some time in the future. */ @@ -574,7 +577,7 @@ do_entry(struct conf_entry * ent) } else if (force) { ent->rotate = 1; snprintf(temp_reason, REASON_MAX, " due to -F request"); - } else if ((ent->trsize > 0) && (ent->fsize >= ent->trsize)) { + } else if (oversized) { ent->rotate = 1; snprintf(temp_reason, REASON_MAX, " due to size>%dK", ent->trsize);