util-lib: introduce new empty_or_root() helper (#8746)

We check the same condition at various places. Let's add a trivial,
common helper for this, and use it everywhere.

It's not going to make things much faster or much shorter, but I think a
lot more readable
This commit is contained in:
Lennart Poettering
2018-04-18 14:20:49 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 12777909c9
commit 57ea45e11a
11 changed files with 50 additions and 18 deletions
+1 -1
View File
@@ -484,7 +484,7 @@ int lookup_paths_init(
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
if (!isempty(root_dir) && !path_equal(root_dir, "/")) {
if (!empty_or_root(root_dir)) {
if (scope == UNIT_FILE_USER)
return -EINVAL;