From: Philippe Guibert Date: Mon, 26 Feb 2018 08:14:50 +0000 (+0100) Subject: lib: do not use ENOSYS errno when returning from ns X-Git-Tag: frr-5.0-dev~209^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=281da0a94dcd14d4f628026ffd628c08df5104f1;p=matthieu%2Ffrr.git lib: do not use ENOSYS errno when returning from ns ENOSYS should not be used for other goals. Signed-off-by: Philippe Guibert --- diff --git a/lib/netns_linux.c b/lib/netns_linux.c index c2282f844c..0e955bade9 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -67,7 +67,7 @@ static inline int setns(int fd, int nstype) #ifdef __NR_setns return syscall(__NR_setns, fd, nstype); #else - errno = ENOSYS; + errno = EINVAL; return -1; #endif } @@ -480,7 +480,7 @@ int ns_switch_to_netns(const char *name) return -1; fd = open(name, O_RDONLY); if (fd == -1) { - errno = ENOSYS; + errno = EINVAL; return -1; } ret = setns(fd, CLONE_NEWNET); @@ -512,7 +512,7 @@ int ns_socket(int domain, int type, int protocol, ns_id_t ns_id) int ret; if (!ns || !ns_is_enabled(ns)) { - errno = ENOSYS; + errno = EINVAL; return -1; } if (have_netns()) {