1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

bpf: fix bpf_can_link_lsm_program condition

Since bpf_can_link_lsm_program return value is boolean, the expression
`r < 0` is always false.

(cherry picked from commit ccfc534dee)
This commit is contained in:
Julia Kartseva 2022-01-09 21:35:35 -08:00 committed by Zbigniew Jędrzejewski-Szmek
parent f9370f9188
commit 617c67a039

View File

@ -167,9 +167,9 @@ int lsm_bpf_supported(void) {
if (r < 0)
return supported = 0;
r = bpf_can_link_lsm_program(obj->progs.restrict_filesystems);
if (r < 0) {
log_warning_errno(r, "Failed to link BPF program. Assuming BPF is not available: %m");
if (!bpf_can_link_lsm_program(obj->progs.restrict_filesystems)) {
log_warning_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Failed to link BPF program. Assuming BPF is not available");
return supported = 0;
}