From 0fe67b16ce7ba3d5aa0f405bf3c2541210bb5320 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 24 May 2007 12:19:56 +0000 Subject: [PATCH] udhcp: socketpair can fail if AF_UNIX is not available (e.g. if module is not loaded). Error out on that. --- networking/udhcp/signalpipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c index 361596580..d52a931a9 100644 --- a/networking/udhcp/signalpipe.c +++ b/networking/udhcp/signalpipe.c @@ -36,7 +36,9 @@ static void signal_handler(int sig) * and installs the signal handler */ void udhcp_sp_setup(void) { - socketpair(AF_UNIX, SOCK_STREAM, 0, signal_pipe); +// BTW, why socketpair and not just pipe? + if (socketpair(AF_UNIX, SOCK_STREAM, 0, signal_pipe)) + bb_perror_msg_and_die("socketpair"); fcntl(signal_pipe[0], F_SETFD, FD_CLOEXEC); fcntl(signal_pipe[1], F_SETFD, FD_CLOEXEC); signal(SIGUSR1, signal_handler);