diff options
author | brooks <brooks@FreeBSD.org> | 2004-03-13 02:35:03 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2004-03-13 02:35:03 +0000 |
commit | d90c60e2d628a89b1bc406a82fbbf86a8e21a747 (patch) | |
tree | 7660cb8dd4d24f25e3e52e2f64fdf2bf7e5c55aa /sys/net/if.c | |
parent | cb7aea29b8d913b12052d75a14a11b0ac819476c (diff) | |
download | FreeBSD-src-d90c60e2d628a89b1bc406a82fbbf86a8e21a747.zip FreeBSD-src-d90c60e2d628a89b1bc406a82fbbf86a8e21a747.tar.gz |
Don't allow interfaces to be renamed to the empty string.
While I'm here, errors aren't bools.
Pointed out by: hmp
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 43a8461..a85d29a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1348,11 +1348,13 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) case SIOCSIFNAME: error = suser(td); - if (error) + if (error != 0) return (error); error = copyinstr(ifr->ifr_data, new_name, IFNAMSIZ, NULL); - if (error) + if (error != 0) return (error); + if (new_name[0] == '\0') + return (EINVAL); if (ifunit(new_name) != NULL) return (EEXIST); |