From f1fef60d11b5f73972babd61e2a5e188505039e5 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Fri, 1 Feb 2019 15:52:36 +0000 Subject: Don't send udp sockets that we failed to open to the frontend, it will crash when it sees a -1 FD. Found the hard way by solene on a box without ::1 --- sbin/unwind/unwind.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sbin') diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c index e582d60b969..d72b98f98b0 100644 --- a/sbin/unwind/unwind.c +++ b/sbin/unwind/unwind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.c,v 1.8 2019/01/29 20:03:49 florian Exp $ */ +/* $OpenBSD: unwind.c,v 1.9 2019/02/01 15:52:35 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -741,6 +741,8 @@ open_ports(void) if (udp4sock == -1 && udp6sock == -1) fatal("could not bind to 127.0.0.1 or ::1 on port 53"); - main_imsg_compose_frontend_fd(IMSG_UDP4SOCK, 0, udp4sock); - main_imsg_compose_frontend_fd(IMSG_UDP6SOCK, 0, udp6sock); + if (udp4sock != -1) + main_imsg_compose_frontend_fd(IMSG_UDP4SOCK, 0, udp4sock); + if (udp6sock != -1) + main_imsg_compose_frontend_fd(IMSG_UDP6SOCK, 0, udp6sock); } -- cgit v1.2.3