summaryrefslogtreecommitdiff
path: root/src/core
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
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')
-rw-r--r--src/core/bpf-firewall.c6
-rw-r--r--src/core/cgroup.c4
2 files changed, 3 insertions, 7 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;
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 426732483e..25778320ab 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -308,13 +308,11 @@ void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix) {
static int lookup_block_device(const char *p, dev_t *dev) {
struct stat st;
- int r;
assert(p);
assert(dev);
- r = stat(p, &st);
- if (r < 0)
+ if (stat(p, &st) < 0)
return log_warning_errno(errno, "Couldn't stat device %s: %m", p);
if (S_ISBLK(st.st_mode))