Date: Sun, 12 Jan 2003 00:59:04 +1100 (EST) From: Joshua Goodall <joshua@roughtrade.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/46974: newsyslog's archival path option doesn't honour -n Message-ID: <20030111135904.1E856230A@leather.shallow.net>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030111135904.1E856230A>