[lxc-devel] [PATCH 2/9] network: check result of if_nametoindex().
Dongsheng Yang
yangds.fnst at cn.fujitsu.com
Tue Sep 16 10:47:34 UTC 2014
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 at cn.fujitsu.com>
---
src/lxc/network.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lxc/network.c b/src/lxc/network.c
index ce10d31..909f3fe 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -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);
}
--
1.8.4.2
More information about the lxc-devel
mailing list