1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-25 18:50:18 +03:00

Merge pull request #13073 from poettering/variety-galore

Variety galore
This commit is contained in:
Lennart Poettering 2019-07-16 15:59:31 +02:00 committed by GitHub
commit 4119ad492f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View File

@ -0,0 +1,11 @@
@@
expression s;
@@
- if (empty_or_root(s))
- s = "/";
+ s = empty_to_root(s);
@@
expression s;
@@
- (empty_or_root(s) ? "/" : s)
+ empty_to_root(s)

View File

@ -369,9 +369,6 @@ static crypto_device *get_crypto_device(const char *uuid) {
if (!d)
return NULL;
d->create = false;
d->keyfile = d->options = d->name = NULL;
d->uuid = strdup(uuid);
if (!d->uuid)
return mfree(d);

View File

@ -31,8 +31,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct
assert(cgroups);
assert(ret);
if (empty_or_root(path))
path = "/";
path = empty_to_root(path);
cg = hashmap_get(cgroups, path);
if (cg) {
@ -48,8 +47,6 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct
return -EINVAL;
pp = strndupa(path, e - path);
if (!pp)
return -ENOMEM;
r = add_cgroup(cgroups, pp, false, &parent);
if (r < 0)
@ -150,8 +147,7 @@ static int dump_processes(
assert(prefix);
if (empty_or_root(cgroup_path))
cgroup_path = "/";
cgroup_path = empty_to_root(cgroup_path);
cg = hashmap_get(cgroups, cgroup_path);
if (!cg)