diff options
-rw-r--r-- | sbin/ifconfig/brconfig.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sbin/ifconfig/brconfig.c b/sbin/ifconfig/brconfig.c index 12ed5e7e99e..1f240b133ce 100644 --- a/sbin/ifconfig/brconfig.c +++ b/sbin/ifconfig/brconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: brconfig.c,v 1.15 2017/06/07 16:47:29 naddy Exp $ */ +/* $OpenBSD: brconfig.c,v 1.16 2017/07/31 02:32:11 jsg Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -203,7 +203,7 @@ addlocal(const char *ifsname, int d) strlcpy(breq.ifbr_ifsname, ifsname, sizeof(breq.ifbr_ifsname)); if (ioctl(s, SIOCBRDGADDL, (caddr_t)&breq) < 0) { if (errno == EEXIST) - errx(1, "%s: local port exists already", name); + return; else err(1, "%s: ioctl SIOCBRDGADDL %s", name, ifsname); } @@ -1076,8 +1076,12 @@ switch_portno(const char *ifname, const char *val) errx(1, "invalid arg for portidx: %s", val); breq.ifbr_portno = newportidx; - if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) < 0) - err(1, "%s", name); + if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) < 0) { + if (errno == EEXIST) + return; + else + err(1, "%s", name); + } } #endif |