diff options
author | des <des@FreeBSD.org> | 2013-10-19 09:59:11 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2013-10-19 09:59:11 +0000 |
commit | e5db34a2652155343d47095d0f8eadf83c2ff758 (patch) | |
tree | 922be1e559152c7c41543d0fa4cae1fc1aaed138 /sbin/ifconfig/ifgroup.c | |
parent | e138182383deacb54e37c154e3a7631d0e021275 (diff) | |
download | FreeBSD-src-e5db34a2652155343d47095d0f8eadf83c2ff758.zip FreeBSD-src-e5db34a2652155343d47095d0f8eadf83c2ff758.tar.gz |
Do not error out when adding an interface to a group to which it
already belongs or removing it from a group to which it does not
belong. This makes it possible to include group memberships in
ifconfig_foo0 in rc.conf without fear of breaking "service netif
restart foo0".
MFC after: 3 days
Diffstat (limited to 'sbin/ifconfig/ifgroup.c')
-rw-r--r-- | sbin/ifconfig/ifgroup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c index 9eaac3b..f8b18b4 100644 --- a/sbin/ifconfig/ifgroup.c +++ b/sbin/ifconfig/ifgroup.c @@ -57,7 +57,7 @@ setifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ) errx(1, "setifgroup: group name too long"); - if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) == -1) + if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) == -1 && errno != EEXIST) err(1," SIOCAIFGROUP"); } @@ -75,7 +75,7 @@ unsetifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ) errx(1, "unsetifgroup: group name too long"); - if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) == -1) + if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) == -1 && errno != ENOENT) err(1, "SIOCDIFGROUP"); } |