summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2021-07-09 13:15:01 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2021-07-09 20:54:22 +0100
commit2f0927626abf6ac6c99a42c1c7fa159063bfc8ee (patch)
tree5ae1a49a9023f7e4e00177f390c9c4a25b06858e /src/nspawn
parent0de0ba573b9c0070b0280300c42111a5b0d7e655 (diff)
downloadsystemd-2f0927626abf6ac6c99a42c1c7fa159063bfc8ee.tar.gz
tree-wide: coccinelle fixes
Yet another batch of Coccinelle fixes.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn-bind-user.c4
-rw-r--r--src/nspawn/nspawn.c2
2 files changed, 2 insertions, 4 deletions
diff --git a/src/nspawn/nspawn-bind-user.c b/src/nspawn/nspawn-bind-user.c
index 6852125b9d..3250cd9768 100644
--- a/src/nspawn/nspawn-bind-user.c
+++ b/src/nspawn/nspawn-bind-user.c
@@ -171,10 +171,8 @@ static int find_free_uid(const char *directory, uid_t max_uid, uid_t *current_ui
/* We want to use the UID also as GID, hence check for it in /etc/group too */
r = check_etc_group_collisions(directory, NULL, (gid_t) *current_uid);
- if (r < 0)
+ if (r <= 0)
return r;
- if (r == 0) /* free! yay! */
- return 0;
}
}
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 04685fecba..3cc028b55b 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4091,7 +4091,7 @@ static int make_uid_map_string(
int r;
assert(n_bind_user_uid == 0 || bind_user_uid);
- assert(offset == 0 || offset == 2); /* used to switch between UID and GID map */
+ assert(IN_SET(offset, 0, 2)); /* used to switch between UID and GID map */
assert(ret);
/* The bind_user_uid[] array is a series of 4 uid_t values, for each --bind-user= entry one