Subject: Re: bin/34979: -current libc causes boot failure
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, scotte@warped.com>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 11/11/2006 22:25:02
The following reply was made to PR bin/34979; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: Scott Ellis <scotte@warped.com>, gnats-bugs@NetBSD.org
Cc: gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: bin/34979: -current libc causes boot failure
Date: Sat, 11 Nov 2006 17:24:26 -0500

 On Nov 11,  2:03pm, scotte@warped.com (Scott Ellis) wrote:
 -- Subject: Re: bin/34979: -current libc causes boot failure
 
 | This appears to be related to syslogd, as setting syslogd=NO in rc.conf 
 | allows the system to boot and be more-or-less fully functional.
 | 
 | This was deduced by noting:
 | 
 | Enabling pf firewall.
 | Building databases...
 | Starting syslogd.
 | Starting pflogd.
 | Nov 11 13:35:59 pflogd[570]: [priv]: msg PRIV_OPEN_LOG received
 | Starting named.
 | Starting named.
 | Stopped in pid 632.1 (syslogd) at       netbsd:cpu_Debugger+0x5: 
 | leave
 | db> step
 | Stopped in pid 632.1 (syslogd) at       netbsd:cpu_Debugger+0x6:        ret
 | db>
 | 
 | Basically the pflogd message isn't set to syslog like it was previously, 
 | and dropping to the debugger shows that syslogd is the current process.
 
 Something seems to be going wrong with the way we open unix sockets? Try
 this:
 
 Index: syslog.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/gen/syslog.c,v
 retrieving revision 1.37
 diff -u -u -r1.37 syslog.c
 --- syslog.c	3 Nov 2006 20:18:49 -0000	1.37
 +++ syslog.c	11 Nov 2006 22:23:33 -0000
 @@ -366,12 +366,12 @@
  	/* AF_UNIX address of local logger */
  	static const struct sockaddr_un sun = {
  		.sun_family = AF_LOCAL,
 -		.sun_len = sizeof(sun),
 +		.sun_len = 0,
  		.sun_path = _PATH_LOG,
  	};
  
  	if (data->log_file == -1 || fcntl(data->log_file, F_GETFL, 0) == -1) {
 -		if ((data->log_file = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
 +		if ((data->log_file = socket(AF_LOCAL, SOCK_DGRAM, 0)) == -1)
  			return;
  		(void)fcntl(data->log_file, F_SETFD, FD_CLOEXEC);
  		data->connected = 0;
 @@ -379,7 +379,7 @@
  	if (!data->connected) {
  		if (connect(data->log_file,
  		    (const struct sockaddr *)(const void *)&sun,
 -		    sizeof(sun)) == -1) {
 +		    SUN_LEN(&sun)) == -1) {
  			(void)close(data->log_file);
  			data->log_file = -1;
   		} else