Don't allow interfaces to be renamed to the empty string.
While I'm here, errors aren't bools. Pointed out by: hmp
This commit is contained in:
parent
196f7f54d2
commit
bc1470f1f1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126901
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user