summaryrefslogtreecommitdiff
path: root/src/core/bpf-firewall.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-24 13:44:09 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-24 14:10:27 +0200
commitb1c05b98bfbfd967ddeaad1c7f827153989013b8 (patch)
treec3a177237ccf0efc94e8ff7467c1eccf66390e2b /src/core/bpf-firewall.c
parent9169e4c7ba0cd2443fd4760b43715cb6d991c784 (diff)
downloadsystemd-b1c05b98bfbfd967ddeaad1c7f827153989013b8.tar.gz
tree-wide: avoid assignment of r just to use in a comparison
This changes r = ...; if (r < 0) to if (... < 0) when r will not be used again.
Diffstat (limited to 'src/core/bpf-firewall.c')
-rw-r--r--src/core/bpf-firewall.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/bpf-firewall.c b/src/core/bpf-firewall.c
index 7dc8467a7f..22cd8e9158 100644
--- a/src/core/bpf-firewall.c
+++ b/src/core/bpf-firewall.c
@@ -728,8 +728,7 @@ int bpf_firewall_supported(void) {
.attach_bpf_fd = -1,
};
- r = bpf(BPF_PROG_ATTACH, &attr, sizeof(attr));
- if (r < 0) {
+ if (bpf(BPF_PROG_ATTACH, &attr, sizeof(attr)) < 0) {
if (errno != EBADF) {
log_debug_errno(errno, "Didn't get EBADF from BPF_PROG_ATTACH, BPF firewalling is not supported: %m");
return supported = BPF_FIREWALL_UNSUPPORTED;
@@ -753,8 +752,7 @@ int bpf_firewall_supported(void) {
.attach_flags = BPF_F_ALLOW_MULTI,
};
- r = bpf(BPF_PROG_ATTACH, &attr, sizeof(attr));
- if (r < 0) {
+ if (bpf(BPF_PROG_ATTACH, &attr, sizeof(attr)) < 0) {
if (errno == EBADF) {
log_debug_errno(errno, "Got EBADF when using BPF_F_ALLOW_MULTI, which indicates it is supported. Yay!");
return supported = BPF_FIREWALL_SUPPORTED_WITH_MULTI;