summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-mount.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-11 14:41:30 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-11 16:46:58 -0400
commitadd554f4e16f3ece6bca1448a5ef4f859984fd8d (patch)
tree6fd4fab7f37e32c721bbe31c5d222c75e9ece300 /src/nspawn/nspawn-mount.c
parentada5412039b7c3e24654bc33550471e0a0869631 (diff)
nspawn: small cleanups in get_controllers()
- check for oom after strdup - no need to truncate the line since we're only extracting one field anyway - use STR_IN_SET
Diffstat (limited to 'src/nspawn/nspawn-mount.c')
-rw-r--r--src/nspawn/nspawn-mount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 0be06c8c09..02dc94cfe1 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -637,8 +637,6 @@ static int get_controllers(Set *subsystems) {
int r;
char *e, *l, *p;
- truncate_nl(line);
-
l = strchr(line, ':');
if (!l)
continue;
@@ -650,10 +648,13 @@ static int get_controllers(Set *subsystems) {
*e = 0;
- if (streq(l, "") || streq(l, "name=systemd"))
+ if (STR_IN_SET(l, "", "name=systemd"))
continue;
p = strdup(l);
+ if (!p)
+ return -ENOMEM;
+
r = set_consume(subsystems, p);
if (r < 0)
return r;