[lxc-devel] [PATCH 1/9] network: convert param ifname to const.

Dongsheng Yang yangds.fnst at cn.fujitsu.com
Tue Sep 16 10:47:33 UTC 2014


We should not modify ifname in lxc_netdev_move_by_name(),
making it as const in param list will make our code more
robust.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
---
 src/lxc/network.c | 2 +-
 src/lxc/network.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index 32edfc4..ce10d31 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -136,7 +136,7 @@ out:
 	return err;
 }
 
-int lxc_netdev_move_by_name(char *ifname, pid_t pid)
+int lxc_netdev_move_by_name(const char *ifname, pid_t pid)
 {
 	int index;
 
diff --git a/src/lxc/network.h b/src/lxc/network.h
index 079d52a..a8e0612 100644
--- a/src/lxc/network.h
+++ b/src/lxc/network.h
@@ -32,7 +32,7 @@ extern int lxc_convert_mac(char *macaddr, struct sockaddr *sockaddr);
  * Move a device between namespaces
  */
 extern int lxc_netdev_move_by_index(int ifindex, pid_t pid);
-extern int lxc_netdev_move_by_name(char *ifname, pid_t pid);
+extern int lxc_netdev_move_by_name(const char *ifname, pid_t pid);
 
 /*
  * Delete a network device
-- 
1.8.4.2



More information about the lxc-devel mailing list