mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-05 21:37:22 +00:00
network: check result of if_nametoindex().
When we want to get index of a ifname which does not exist, we should return a -EINVAL in this case. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
599781664b
commit
49428bf306
@ -144,6 +144,8 @@ int lxc_netdev_move_by_name(const char *ifname, pid_t pid)
|
||||
return -EINVAL;
|
||||
|
||||
index = if_nametoindex(ifname);
|
||||
if (!index)
|
||||
return -EINVAL;
|
||||
|
||||
return lxc_netdev_move_by_index(index, pid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user