diff options
author | Wraithh <[email protected]> | 2023-11-29 19:55:17 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-29 09:55:17 -0800 |
commit | 8adf2e30665c412d8045f7c20d5426e954280357 (patch) | |
tree | 181cd50ad526fe48312b6e5f3542187098f8a5d6 /lib | |
parent | 7d68900af367ca4ce2922207b19c97a4261c703d (diff) |
Fix zoneid when USER_NS is disabled
getzoneid() should return GLOBAL_ZONEID instead of 0 when USER_NS is disabled.
Reviewed-by: Richard Yao <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ilkka Sovanto <[email protected]>
Closes #15560
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libspl/os/linux/zone.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libspl/os/linux/zone.c b/lib/libspl/os/linux/zone.c index 622d04cbc..f8a10bfa1 100644 --- a/lib/libspl/os/linux/zone.c +++ b/lib/libspl/os/linux/zone.c @@ -42,20 +42,20 @@ getzoneid(void) int c = snprintf(path, sizeof (path), "/proc/self/ns/user"); /* This API doesn't have any error checking... */ if (c < 0 || c >= sizeof (path)) - return (0); + return (GLOBAL_ZONEID); ssize_t r = readlink(path, buf, sizeof (buf) - 1); if (r < 0) - return (0); + return (GLOBAL_ZONEID); cp = strchr(buf, '['); if (cp == NULL) - return (0); + return (GLOBAL_ZONEID); cp++; unsigned long n = strtoul(cp, NULL, 10); if (n == ULONG_MAX && errno == ERANGE) - return (0); + return (GLOBAL_ZONEID); zoneid_t z = (zoneid_t)n; return (z); |