Subject: bin/12453: newsyslog(8) does not send custom signals
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hf@tangro.de>
List: netbsd-bugs
Date: 03/22/2001 18:40:09
>Number:         12453
>Category:       bin
>Synopsis:       newsyslog(8) does not send custom signals
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 22 09:41:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hauke Fath <hf@tangro.de>
>Release:        -current of 22 Mar 2001
>Organization:
Tangro GmbH -- does not speak for me and vice versa.
>Environment:
	
System: NetBSD jump 1.5R NetBSD 1.5R (JUMP) #0: Sat Mar 17 20:46:24 CET 2001 hf@scree:/local/tmpa/netbsd-pre1.6/usr/src/sys/arch/i386/compile/JUMP i386
Architecture: i386
Machine: i386
>Description:
	Imported from FreeBSD, the 1.5 NetBSD newsyslog(8) is able to
send arbitrary processes an arbitrary signal when it rotates their logs.
Unfortunately, the current implementation always sends SIGHUP, no matter
what you specify in the config file.

>How-To-Repeat:
	Try to rotate Squid logs with newsyslog because it zips and 
Squid does not. Find that a "kill -USR1" does work from the command line,
but the logfiles remain empty after newsyslog touched them.

>Fix:
That's what you get when you cram logical expressions into one statement...
Appply the following patch:

--- newsyslog.c.orig	Mon Mar 19 12:40:53 2001
+++ newsyslog.c	Thu Mar 22 18:25:59 2001
@@ -376,10 +376,12 @@
 		log->pidfile[0] = '\0';
 
 	/* sigtype */
-	if (*ap != NULL && (log->signum = getsig(*ap++)) < 0) {
-		warnx("config line %d: bad signal type", lineno);
-		goto bad;
-	} else
+	if (*ap != NULL)
+		if ((log->signum = getsig(*ap++)) < 0) {
+			warnx("config line %d: bad signal type", lineno);
+			goto bad;
+		}
+	else
 		log->signum = SIGHUP;
 
 	rv = 0;
>Release-Note:
>Audit-Trail:
>Unformatted: