1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

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
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-10-11 14:41:30 -04:00
parent ada5412039
commit add554f4e1

View File

@ -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;