diff options
author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-09-06 06:36:07 +0000 |
---|---|---|
committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-09-06 06:36:07 +0000 |
commit | 8e1d470afc4af413059fdeacd30e25c1d905da6f (patch) | |
tree | 0239c1590840785cfe47c2e9449f4edfe6d19f86 /usr.sbin/newsyslog/newsyslog.c | |
parent | df3f7155e946f0dc68cbd2b59ac73bffc700c22d (diff) | |
download | src-8e1d470afc4af413059fdeacd30e25c1d905da6f.tar.gz src-8e1d470afc4af413059fdeacd30e25c1d905da6f.zip |
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>
Notes
Notes:
svn path=/head/; revision=18075
Diffstat (limited to 'usr.sbin/newsyslog/newsyslog.c')
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 722e4548b6a2..4fbfbfa693fd 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 { |