Commit bcf1aae8 authored by vadimk's avatar vadimk Committed by Stephen Hemminger

ip netns: Show error message if mkdir failed to create /var/run/netns

Currently if mkdir failed with "Permission denied" error then "mount --make-shared ..."
error message will be showed because /var/run/netns does not exist.
Signed-off-by: default avatarVadim Kochan <vadim4j@gmail.com>
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
parent cdb2227e
...@@ -407,7 +407,13 @@ static int netns_add(int argc, char **argv) ...@@ -407,7 +407,13 @@ static int netns_add(int argc, char **argv)
snprintf(netns_path, sizeof(netns_path), "%s/%s", NETNS_RUN_DIR, name); snprintf(netns_path, sizeof(netns_path), "%s/%s", NETNS_RUN_DIR, name);
/* Create the base netns directory if it doesn't exist */ /* Create the base netns directory if it doesn't exist */
mkdir(NETNS_RUN_DIR, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); if (mkdir(NETNS_RUN_DIR, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)) {
if (errno != EEXIST) {
fprintf(stderr, "mkdir %s failed: %s\n",
NETNS_RUN_DIR, strerror(errno));
return -1;
}
}
/* Make it possible for network namespace mounts to propagate between /* Make it possible for network namespace mounts to propagate between
* mount namespaces. This makes it likely that a unmounting a network * mount namespaces. This makes it likely that a unmounting a network
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment