Skip to content

Commit

Permalink
cgroups/devices: do not log error when bpf device feature is not avai…
Browse files Browse the repository at this point in the history
…lable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 4, 2019
1 parent 29b785e commit 60a22a6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/lxc/cgroups/cgroup2_devices.c
Expand Up @@ -511,23 +511,20 @@ bool bpf_devices_cgroup_supported(void)
int ret;

if (geteuid() != 0)
return log_error_errno(false,
EINVAL, "The bpf device cgroup requires real root");
return log_trace(false,
"The bpf device cgroup requires real root");

prog = bpf_program_new(BPF_PROG_TYPE_CGROUP_DEVICE);
if (prog < 0)
return log_error_errno(false,
errno, "Failed to allocate new bpf device cgroup program");
return log_trace(false, "Failed to allocate new bpf device cgroup program");

ret = bpf_program_add_instructions(prog, dummy, ARRAY_SIZE(dummy));
if (ret < 0)
return log_error_errno(false,
errno, "Failed to add new instructions to bpf device cgroup program");
return log_trace(false, "Failed to add new instructions to bpf device cgroup program");

ret = bpf_program_load_kernel(prog, NULL, 0);
if (ret < 0)
return log_error_errno(false,
errno, "Failed to load new bpf device cgroup program");
return log_trace(false, "Failed to load new bpf device cgroup program");

return log_trace(true, "The bpf device cgroup is supported");
}
Expand Down

0 comments on commit 60a22a6

Please sign in to comment.