Skip to content

Commit

Permalink
crun: fix return code check for cgroupfs
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 18, 2020
1 parent 63e91ff commit 40f433d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcrun/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ libcrun_cgroup_enter (struct libcrun_cgroup_args *args, libcrun_error_t *err)
default:
return crun_make_error (err, EINVAL, "unknown cgroup manager specified %d", manager);
}
if (LIKELY (ret == 0))
if (LIKELY (ret >= 0))
{
if (cgroup_mode == CGROUP_MODE_UNIFIED && (root_uid != (uid_t) -1 || root_gid != (gid_t) -1))
return chown_cgroups (*path, root_uid, root_gid, err);
Expand All @@ -1416,7 +1416,7 @@ libcrun_cgroup_enter (struct libcrun_cgroup_args *args, libcrun_error_t *err)
{
crun_error_release (err);
*err = tmp_err;
return ret;
return rootless;
}

if (rootless > 0 && (cgroup_mode != CGROUP_MODE_UNIFIED || manager != CGROUP_MANAGER_SYSTEMD))
Expand Down

0 comments on commit 40f433d

Please sign in to comment.