summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-09-06 06:36:07 +0000
committerjkh <jkh@FreeBSD.org>1996-09-06 06:36:07 +0000
commitbbacb62fd0171e0396ab8ce90f23482d80c3dafc (patch)
tree0239c1590840785cfe47c2e9449f4edfe6d19f86 /usr.sbin/newsyslog
parente869b601450b170207f89fa9c6a4043f957a7a05 (diff)
downloadFreeBSD-src-bbacb62fd0171e0396ab8ce90f23482d80c3dafc.zip
FreeBSD-src-bbacb62fd0171e0396ab8ce90f23482d80c3dafc.tar.gz
PR#2724 in NetBSD notes that newsyslog save log files even if the number
of copies to save is zero. Incorporate suggested fix with some stylistic cleanup to make the resulting code more readable. Submitted-By: Kenneth Stailey <kstailey@dol-esa.gov>
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 722e454..4fbfbfa 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -24,12 +24,12 @@ provided "as is" without express or implied warranty.
* newsyslog - roll over selected logs at the appropriate time,
* keeping the a specified number of backup files around.
*
- * $Source: /usr/cvs/src/usr.sbin/newsyslog/newsyslog.c,v $
+ * $Source: /home/ncvs/src/usr.sbin/newsyslog/newsyslog.c,v $
* $Author: alex $
*/
#ifndef lint
-static char rcsid[] = "$Id: newsyslog.c,v 1.4 1996/06/07 16:27:28 alex Exp $";
+static char rcsid[] = "$Id: newsyslog.c,v 1.5 1996/06/08 23:32:10 alex Exp $";
#endif /* not lint */
#ifndef CONF
@@ -420,10 +420,19 @@ static void dotrim(log,numdays,flags,perm,owner_uid,group_gid)
if (!noaction && !(flags & CE_BINARY))
(void) log_trim(log); /* Report the trimming to the old log */
- if (noaction)
- printf("mv %s to %s\n",log,file1);
- else
- (void) rename(log,file1);
+ 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 {
OpenPOWER on IntegriCloud