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;
}
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);
}
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;