From owner-freebsd-bugs Sat Jan 11 6: 0:12 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D37F537B401 for ; Sat, 11 Jan 2003 06:00:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15B8B43ED8 for ; Sat, 11 Jan 2003 06:00:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h0BE09NS038304 for ; Sat, 11 Jan 2003 06:00:09 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h0BE09N1038303; Sat, 11 Jan 2003 06:00:09 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 61B9E37B401 for ; Sat, 11 Jan 2003 05:59:28 -0800 (PST) Received: from leather.shallow.net (c16486.smelb1.vic.optusnet.com.au [210.49.224.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF8E943EB2 for ; Sat, 11 Jan 2003 05:59:27 -0800 (PST) (envelope-from joshua@leather.shallow.net) Received: by leather.shallow.net (Postfix, from userid 1001) id 1E856230A; Sun, 12 Jan 2003 00:59:04 +1100 (EST) Message-Id: <20030111135904.1E856230A@leather.shallow.net> Date: Sun, 12 Jan 2003 00:59:04 +1100 (EST) From: Joshua Goodall Reply-To: Joshua Goodall To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/46974: newsyslog's archival path option doesn't honour -n Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46974 >Category: bin >Synopsis: newsyslog's archival path option doesn't honour -n >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 11 06:00:09 PST 2003 >Closed-Date: >Last-Modified: >Originator: Joshua Goodall >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD leather.shallow.net 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Sat Jan 4 19:42:54 EST 2003 joshua@leather.shallow.net:/usr/obj/usr/src/sys/LEATHER i386 >Description: newsyslog's -a option exists to archive logfiles to a directory. It creates the path if it does not already exist. The -n option is supposedly a "dry run" option; however it fails to suppress the path creation. >How-To-Repeat: Execute (with a stock /etc/newsyslog.conf): # newsyslog -nv -a foo ( the directory /var/log/foo now exists ) >Fix: Index: newsyslog.c =================================================================== RCS file: /cvs/src/usr.sbin/newsyslog/newsyslog.c,v retrieving revision 1.49 diff -u -r1.49 newsyslog.c --- newsyslog.c 21 Dec 2002 22:27:26 -0000 1.49 +++ newsyslog.c 11 Jan 2003 13:42:05 -0000 @@ -582,8 +582,12 @@ } /* check if archive directory exists, if not, create it */ - if (lstat(dirpart, &st)) - createdir(dirpart); + if (lstat(dirpart, &st)) { + if (noaction) + printf("mkdir -p %s\n", dirpart); + else + createdir(dirpart); + } /* get filename part of logfile */ if ((p = rindex(log, '/')) == NULL) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message