diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-11-07 05:31:54 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-11-07 05:31:54 +0000 |
commit | bab8bf2167fab743a4dee7d1a8a597458858ab5d (patch) | |
tree | 1a5ee823e6cda186b8a0c1651d7fb2905620e4ba /usr.bin/newsyslog | |
parent | 23af678eeeee8ae225f9f37ea6c82287fdf63c96 (diff) |
compress_log() now needs to check for noaction != 0
Diffstat (limited to 'usr.bin/newsyslog')
-rw-r--r-- | usr.bin/newsyslog/newsyslog.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c index 3882822633a..d5be4335902 100644 --- a/usr.bin/newsyslog/newsyslog.c +++ b/usr.bin/newsyslog/newsyslog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newsyslog.c,v 1.26 1999/11/07 05:16:28 millert Exp $ */ +/* $OpenBSD: newsyslog.c,v 1.27 1999/11/07 05:31:53 millert Exp $ */ /* * Copyright (c) 1997, Jason Downs. All rights reserved. @@ -61,7 +61,7 @@ provided "as is" without express or implied warranty. */ #ifndef lint -static char rcsid[] = "$OpenBSD: newsyslog.c,v 1.26 1999/11/07 05:16:28 millert Exp $"; +static char rcsid[] = "$OpenBSD: newsyslog.c,v 1.27 1999/11/07 05:31:53 millert Exp $"; #endif /* not lint */ #ifndef CONF @@ -586,14 +586,23 @@ compress_log(log) char *log; { pid_t pid; + char *base; char tmp[MAXPATHLEN]; + if ((base = strrchr(COMPRESS, '/')) == NULL) + base = COMPRESS; + else + base++; + if (noaction) { + printf("%s %s.0\n", base, log); + return; + } pid = fork(); (void)sprintf(tmp, "%s.0", log); if (pid < 0) { err(1, "fork"); } else if (!pid) { - (void)execl(COMPRESS, "compress", "-f", tmp, 0); + (void)execl(COMPRESS, base, "-f", tmp, 0); warn(COMPRESS); _exit(1); } |