Subject: bin/2724: newsyslog save log even if number of copies to save is zero
To: None <gnats-bugs@NetBSD.ORG>
From: Kenneth Stailey <kstailey@dol-esa.gov>
List: netbsd-bugs
Date: 08/30/1996 17:57:47
>Number:         2724
>Category:       bin
>Synopsis:       newsyslog save log even if number of copies to save is zero
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 30 18:20:02 1996
>Last-Modified:
>Originator:     Kenneth Stailey
>Organization:
DOL/ESA/DASM
>Release:        1.2_BETA
>Environment:
	
System: NetBSD owl 1.2_BETA NetBSD 1.2_BETA (OWL) #3: Wed Aug 21 18:26:07 EDT 1996 kstailey@owl:/usr/src/sys/arch/i386/compile/OWL [960807] i386


>Description:
There is a field "ngen" in newsyslog.conf that is supposed to be the number
of copies of the log to save.  There is no difference in the behaviour
of newsyslog if this field is set to one or zero.
>How-To-Repeat:
Set ngen to zero in /etc/newsyslog.conf, run newsyslog and get copies of log
file anyway.
>Fix:
--- newsyslog.c.DIST	Fri Aug 30 17:38:33 1996
+++ newsyslog.c	Fri Aug 30 17:55:43 1996
@@ -427,10 +427,17 @@
         if (!noaction && !(flags & CE_BINARY))
                 (void) log_trim(log);  /* Report the trimming to the old log */
 
+	if (numdays == -1)
+		if (noaction)
+			printf("rm %s\n",log);
+		else
+			(void) unlink(log);
+	else
         if (noaction) 
                 printf("mv %s to %s\n",log,file1);
         else
                 (void) rename(log,file1);
+
         if (noaction) 
                 printf("Start new log...");
         else {
>Audit-Trail:
>Unformatted: