Bug 178

Summary: Wrong "-n" printout
Product: Newsyslog Reporter: Anthony O.Zabelin <rz1a>
Component: NewsyslogAssignee: Todd C. Miller <Todd.Miller>
Status: NEW ---    
Severity: normal    
Priority: normal    
Version: 1.1   
Hardware: All   
OS: All   

Description Anthony O.Zabelin 2005-05-12 05:11:13 MDT
Running "newsyslog -n" shows wrong log-file pending for packing. Currently it 
is the log itself, the below patch makes it show the actual filename (i.e. 
log.0) as prepared for gzipping.
Also I ported the *BRILLIANT* utility to QNX4.
Thank you for the nice job!

Regards,
 Anthony O.Zabelin

diff -ru newsyslog-1.1/Makefile.in newsyslog-1.1p2-QNX4/Makefile.in
--- newsyslog-1.1/Makefile.in	2003-02-12 22:24:57.000000000 +0300
+++ newsyslog-1.1p2-QNX4/Makefile.in	2005-05-12 04:09:47.000000000 +0400
@@ -82,7 +82,7 @@
 
 OBJS = newsyslog.$(OBJEXT) @LIBOBJS@
 
-VERSION = 1.1
+VERSION = 1.1p2
 
 DISTFILES = INSTALL INSTALL.configure LICENSE Makefile.in README RELEASE_NOTES 
\
 	    config.guess config.h.in config.sub configure configure.in err.c \
diff -ru newsyslog-1.1/RELEASE_NOTES newsyslog-1.1p2-QNX4/RELEASE_NOTES
--- newsyslog-1.1/RELEASE_NOTES	2003-02-19 00:22:07.000000000 +0300
+++ newsyslog-1.1p2-QNX4/RELEASE_NOTES	2005-05-12 04:30:56.000000000 +0400
@@ -1,6 +1,11 @@
                          NEWSYSLOG RELEASE NOTES
 	$Id: RELEASE_NOTES,v 1.3 2003/02/18 21:22:07 millert Exp $
 
+newsyslog 1.1p2 released: 05/12/2005
+	Fixed "newsyslog -n" to show the correct filename(s) as going to be
+	packed.
+	Portability: made QNX4-aware.
+
 newsyslog 1.1 released: 02/18/2003
 	Fixed check for symlinks in non-verbose mode.
 	Improved readability of "newsyslog -n".
diff -ru newsyslog-1.1/newsyslog.c newsyslog-1.1p2-QNX4/newsyslog.c
--- newsyslog-1.1/newsyslog.c	2003-02-12 23:05:32.000000000 +0300
+++ newsyslog-1.1p2-QNX4/newsyslog.c	2005-05-12 04:40:40.000000000 +0400
@@ -886,7 +886,7 @@
 	else
 		base++;
 	if (noaction) {
-		printf("%s %s\n", base, ent->log);
+		printf("%s %s\n", base, tmp); /* BUG! Show the old log being 
ziped */
 		return;
 	}
 	pid = fork();
@@ -908,10 +908,12 @@
 	if (stat(file, &sb) < 0)
 		return (-1);
 
+#ifndef __QNX__
 	/* For sparse files, return the size based on number of blocks used. */
 	if (sb.st_size / DEV_BSIZE > sb.st_blocks)
 		return (sb.st_blocks * DEV_BSIZE);
 	else
+#endif
 		return (sb.st_size);
 }