From aa570dfb7b7393e8f6eb0151d6233d70dac9a78b Mon Sep 17 00:00:00 2001 From: dlg Date: Sat, 24 Feb 2018 06:31:47 +0000 Subject: [PATCH] return early on some unhandled ioctls rather than err(). --- sbin/ifconfig/brconfig.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sbin/ifconfig/brconfig.c b/sbin/ifconfig/brconfig.c index 86d59394569..0ab432b6bed 100644 --- a/sbin/ifconfig/brconfig.c +++ b/sbin/ifconfig/brconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: brconfig.c,v 1.18 2018/02/08 13:15:32 mpi Exp $ */ +/* $OpenBSD: brconfig.c,v 1.19 2018/02/24 06:31:47 dlg Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -276,8 +276,12 @@ bridge_cfg(const char *delim) u_int16_t bprio; strlcpy(ifbp.ifbop_name, name, sizeof(ifbp.ifbop_name)); - if (ioctl(s, SIOCBRDGGPARAM, (caddr_t)&ifbp)) - err(1, "%s", name); + if (ioctl(s, SIOCBRDGGPARAM, (caddr_t)&ifbp) == -1) { + if (errno == ENOTTY) + return; + err(1, "%s SIOCBRDGGPARAM", name); + } + printf("%s", delim); pri = ifbp.ifbop_priority; ht = ifbp.ifbop_hellotime; @@ -320,8 +324,11 @@ bridge_list(char *delim) err(1, "malloc"); bifc.ifbic_buf = inbuf = inb; strlcpy(bifc.ifbic_name, name, sizeof(bifc.ifbic_name)); - if (ioctl(s, SIOCBRDGIFS, &bifc) < 0) - err(1, "%s", name); + if (ioctl(s, SIOCBRDGIFS, &bifc) < 0) { + if (errno == ENOTTY) + return; + err(1, "%s SIOCBRDGIFS", name); + } if (bifc.ifbic_len + sizeof(*reqp) < len) break; len *= 2; -- 2.20.1