NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: System fails to start dhclient at boot after upgrade 6.1.5 -> 7.0.1



Can you try the below patch?  I've ran into this by accident but haven't
gotten around to file a PR yet.  I'm also not sure if this is relevant
to you problem, but it sure is a wait-for-something mechanism that
couldn't possibly work because it had its pipe ends switched so far.

(from pipe(2): The first descriptor connects to the read end of the pipe,
and the second connects to the write end) 

--- external/bsd/dhcp/dist/client/dhclient.c.orig
+++ external/bsd/dhcp/dist/client/dhclient.c
@@ -3701,8 +3701,8 @@ void finish_daemon (void)
 	write_client_pid_file ();
 
 	IGNORE_RET (chdir("/"));
-	write(pfd[0], "X", 1);
-	close(pfd[0]);
+	write(pfd[1], "X", 1);
+	close(pfd[1]);
 }
 
 void go_daemon (void)
@@ -3723,11 +3724,11 @@ void go_daemon (void)
 		log_fatal ("Can't fork daemon: %m");
 	else if (pid) {
 		char c;
-		close(pfd[0]);
-		read(pfd[1], &c, 1);
+		close(pfd[1]);
+		read(pfd[0], &c, 1);
 		exit (0);
 	} else
-		close(pfd[1]);
+		close(pfd[0]);
 }
 
 void write_client_pid_file ()


Home | Main Index | Thread Index | Old Index