>From 88494a34106df25827cb46820f6272915bee6e85 Mon Sep 17 00:00:00 2001 From: Chris J Arges Date: Fri, 13 Dec 2013 12:29:12 -0600 Subject: [PATCH] Fix for upgrade regression in 58a3e827 Commit 58a3e8270fe72f8ed92687d3a3132c2a708582dd introduces a regression when upgrading code with existing active network namespaces. Test case: ip netns add first ip netns exec first bash < upgrade to 58a3e827 version > ip netns add second ip netns exec second bash ip netns exec first bash This will work if you are using only versions before this commit, or only versions after the commit. Otherwise you will get the following message: seting the network namespace failed: Invalid argument This also fixes the spelling error in that message. Signed-off-by: Chris J Arges --- ip/ipnetns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 89dda3f..c5d7bde 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -158,7 +158,7 @@ static int netns_exec(int argc, char **argv) } if (setns(netns, CLONE_NEWNET) < 0) { - fprintf(stderr, "seting the network namespace \"%s\" failed: %s\n", + fprintf(stderr, "setting the network namespace \"%s\" failed: %s\n", name, strerror(errno)); return -1; } @@ -424,6 +424,7 @@ static int netns_add(int argc, char **argv) } /* Upgrade NETNS_RUN_DIR to a mount point */ + errno = 0; if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND, NULL)) { fprintf(stderr, "mount --bind %s %s failed: %s\n", NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno)); -- 1.7.9.5