diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-07 17:54:49 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-08 11:01:29 +0200 |
commit | 875e7b25d84a111755dab79241c9e64e44836910 (patch) | |
tree | f4856a8ce16871c89a3d7700aa317785dd38a5d1 /src/tmpfiles | |
parent | bec890e3cd6dac249cb12ce9430fdb78b6cf546b (diff) | |
download | systemd-875e7b25d84a111755dab79241c9e64e44836910.tar.gz |
tmpfiles: rework condition check
(!a && b) || (a && c) is replaced by (a ? c : b).
path_startswith() != NULL is need to avoid type warning.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index df2b90e88f..8b58ac95e4 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3251,7 +3251,11 @@ static int read_config_file(char **config_dirs, const char *fn, bool ignore_enoe for (size_t nj = 0; nj < ja->n_items; nj++) { Item *j = ja->items + nj; - if (!IN_SET(j->type, CREATE_DIRECTORY, TRUNCATE_DIRECTORY, CREATE_SUBVOLUME, CREATE_SUBVOLUME_INHERIT_QUOTA, CREATE_SUBVOLUME_NEW_QUOTA)) + if (!IN_SET(j->type, CREATE_DIRECTORY, + TRUNCATE_DIRECTORY, + CREATE_SUBVOLUME, + CREATE_SUBVOLUME_INHERIT_QUOTA, + CREATE_SUBVOLUME_NEW_QUOTA)) continue; if (path_equal(j->path, i->path)) { @@ -3259,8 +3263,9 @@ static int read_config_file(char **config_dirs, const char *fn, bool ignore_enoe break; } - if ((!candidate_item && path_startswith(i->path, j->path)) || - (candidate_item && path_startswith(j->path, candidate_item->path) && (fnmatch(i->path, j->path, FNM_PATHNAME | FNM_PERIOD) == 0))) + if (candidate_item + ? (path_startswith(j->path, candidate_item->path) && fnmatch(i->path, j->path, FNM_PATHNAME | FNM_PERIOD) == 0) + : path_startswith(i->path, j->path) != NULL) candidate_item = j; } |