]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: do not use ENOSYS errno when returning from ns
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 26 Feb 2018 08:14:50 +0000 (09:14 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 27 Feb 2018 10:11:24 +0000 (11:11 +0100)
ENOSYS should not be used for other goals.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/netns_linux.c

index c2282f844c80c1798e134953514f32065bae7c92..0e955bade927137edafbfda3ee2c31e3b9d178d6 100644 (file)
@@ -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()) {