Merge pull request #2010 from donaldsharp/ns_fixes

lib: Namespaces should only complain about failure if we have it
This commit is contained in:
Philippe Guibert 2018-04-03 17:14:42 +02:00 committed by GitHub
commit 53397a95e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -412,9 +412,12 @@ void ns_init(void)
return;
errno = 0;
#ifdef HAVE_NETNS
if (have_netns_enabled < 0)
if (have_netns_enabled < 0) {
ns_default_ns_fd = open(NS_DEFAULT_NAME, O_RDONLY);
else {
if (ns_default_ns_fd == -1)
zlog_err("NS initialization failure %d(%s)",
errno, safe_strerror(errno));
} else {
ns_default_ns_fd = -1;
default_ns = NULL;
}
@ -422,9 +425,6 @@ void ns_init(void)
ns_default_ns_fd = -1;
default_ns = NULL;
#endif /* HAVE_NETNS */
if (ns_default_ns_fd == -1)
zlog_err("NS initialisation failure (%s)",
safe_strerror(errno));
ns_current_ns_fd = -1;
ns_initialised = 1;
}