cgroups: make use of ERRNO_IS_NOT_SUPPORTED()

This will hopefully prevent backwards compatibility fallback errors. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 0e48c43b
......@@ -1641,7 +1641,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
ret = cgroup_attach(conf, name, lxcpath, pid);
if (ret) {
call_cleaner(cgroup_exit) struct cgroup_ops *cgroup_ops = NULL;
if (ret != -ENOCGROUP2 && ret != -ENOSYS) {
if (!ERRNO_IS_NOT_SUPPORTED(ret)) {
SYSERROR("Failed to attach cgroup");
goto on_error;
}
......
......@@ -3419,7 +3419,7 @@ static int __cgroup_attach_unified(const struct lxc_conf *conf, const char *name
dfd_unified = lxc_cmd_get_cgroup2_fd(name, lxcpath);
if (dfd_unified < 0)
return ret_errno(ENOCGROUP2);
return ret_errno(ENOSYS);
return __unified_attach_fd(conf, dfd_unified, pid);
}
......@@ -3431,10 +3431,12 @@ int cgroup_attach(const struct lxc_conf *conf, const char *name,
ret = __cgroup_attach_many(conf, name, lxcpath, pid);
if (ret < 0) {
if (ret != -ENOSYS)
if (!ERRNO_IS_NOT_SUPPORTED(ret))
return ret;
ret = __cgroup_attach_unified(conf, name, lxcpath, pid);
if (ret < 0 && ERRNO_IS_NOT_SUPPORTED(ret))
return ret_errno(ENOSYS);
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment