]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
uid-range: error code tweak for uid_range_load_userns()
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Sep 2022 16:25:37 +0000 (18:25 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Sep 2022 21:27:29 +0000 (06:27 +0900)
Let's return ENOSYS if /proc/ is not mounted (as that's what we usually
return in that case in various helpers that operate on /proc/). Return
EOPNOTSUPP if the kernel simply doesn't support userns.

src/shared/uid-range.c

index 1b4396a34cc70f396ed7077ded270651fff26f68..630bf42f92e1ef691f0a2012847bd4a3b3e540b1 100644 (file)
@@ -212,8 +212,8 @@ int uid_range_load_userns(UidRange **p, size_t *n, const char *path) {
         if (!f) {
                 r = -errno;
 
-                if (r == -ENOENT && path_startswith(path, "/proc/") && proc_mounted() > 0)
-                        return -EOPNOTSUPP;
+                if (r == -ENOENT && path_startswith(path, "/proc/"))
+                        return proc_mounted() > 0 ? -EOPNOTSUPP : -ENOSYS;
 
                 return r;
         }