From 281da0a94dcd14d4f628026ffd628c08df5104f1 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 26 Feb 2018 09:14:50 +0100 Subject: [PATCH] lib: do not use ENOSYS errno when returning from ns ENOSYS should not be used for other goals. Signed-off-by: Philippe Guibert --- lib/netns_linux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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()) { -- 2.39.5