mirror of https://github.com/PentHertz/srsLTE.git
gw: Proper error log on non-existing netns
This commit is contained in:
parent
be7c5a009d
commit
1d81ef9e24
|
@ -347,6 +347,12 @@ int gw::init_if(char* err_str)
|
||||||
std::string netns("/run/netns/");
|
std::string netns("/run/netns/");
|
||||||
netns += args.netns;
|
netns += args.netns;
|
||||||
netns_fd = open(netns.c_str(), O_RDONLY);
|
netns_fd = open(netns.c_str(), O_RDONLY);
|
||||||
|
if (netns_fd == -1) {
|
||||||
|
err_str = strerror(errno);
|
||||||
|
log.error("Failed to find netns %s (%s): %s\n",
|
||||||
|
args.netns.c_str(), netns.c_str(), err_str);
|
||||||
|
return SRSLTE_ERROR_CANT_START;
|
||||||
|
}
|
||||||
if (setns(netns_fd, CLONE_NEWNET) == -1) {
|
if (setns(netns_fd, CLONE_NEWNET) == -1) {
|
||||||
err_str = strerror(errno);
|
err_str = strerror(errno);
|
||||||
log.error("Failed to change netns: %s\n", err_str);
|
log.error("Failed to change netns: %s\n", err_str);
|
||||||
|
|
Loading…
Reference in New Issue