From owner-svn-src-stable@FreeBSD.ORG Sun Jan 13 04:14:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AEDF9862; Sun, 13 Jan 2013 04:14:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 888246E9; Sun, 13 Jan 2013 04:14:31 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0D4EVmb095790; Sun, 13 Jan 2013 04:14:31 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0D4EV4E095788; Sun, 13 Jan 2013 04:14:31 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201301130414.r0D4EV4E095788@svn.freebsd.org> From: Mark Johnston Date: Sun, 13 Jan 2013 04:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r245359 - stable/8/usr.sbin/newsyslog X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jan 2013 04:14:31 -0000 Author: markj Date: Sun Jan 13 04:14:30 2013 New Revision: 245359 URL: http://svnweb.freebsd.org/changeset/base/245359 Log: MFC r244995 r244996 r244997. MFC r244995: Fix a typo in an error message. MFC r244996: Have -n imply -r, since dry-run mode obviously doesn't require root privileges. MFC r244997: Make sure to update the mtime of a logfile after archiving it. This ensures that the next rotation happens at the correct time when using interval-based rotations. Approved by: rstone (co-mentor) Modified: stable/8/usr.sbin/newsyslog/newsyslog.8 stable/8/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/8/usr.sbin/newsyslog/ (props changed) Modified: stable/8/usr.sbin/newsyslog/newsyslog.8 ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.8 Sun Jan 13 04:13:45 2013 (r245358) +++ stable/8/usr.sbin/newsyslog/newsyslog.8 Sun Jan 13 04:14:30 2013 (r245359) @@ -126,7 +126,9 @@ reasons for either trimming that log or Cause .Nm not to trim the logs, but to print out what it would do if this option -were not specified. +were not specified. This option implies the +.Fl r +option. .It Fl r Remove the restriction that .Nm Modified: stable/8/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.c Sun Jan 13 04:13:45 2013 (r245358) +++ stable/8/usr.sbin/newsyslog/newsyslog.c Sun Jan 13 04:14:30 2013 (r245359) @@ -639,7 +639,7 @@ parse_args(int argc, char **argv) break; case 'n': noaction++; - break; + /* FALLTHROUGH */ case 'r': needroot = 0; break; @@ -1576,7 +1576,7 @@ delete_oldest_timelog(const struct conf_ oldlogs[i].fname); else if (unlinkat(dirfd, oldlogs[i].fname, 0) != 0) { snprintf(errbuf, sizeof(errbuf), - "Could not delet old logfile '%s'", + "Could not delete old logfile '%s'", oldlogs[i].fname); perror(errbuf); } @@ -1778,12 +1778,21 @@ do_rotate(const struct conf_entry *ent) printf("\tcp %s %s\n", ent->log, file1); else printf("\tln %s %s\n", ent->log, file1); + printf("\ttouch %s\t\t" + "# Update mtime for 'when'-interval processing\n", + file1); } else { if (!(flags & CE_BINARY)) { /* Report the trimming to the old log */ log_trim(ent->log, ent); } savelog(ent->log, file1); + /* + * Interval-based rotations are done using the mtime of + * the most recently archived log, so make sure it gets + * updated during a rotation. + */ + utimes(file1, NULL); } change_attrs(file1, ent); }