namespace: ignore prefix chars when comparing paths

Other callers of path_strv_contains() or PATH_IN_SET() don't seem to handle
paths prefixed with -+.
This commit is contained in:
Topi Miettinen
2020-03-10 16:48:34 +02:00
parent 3b5b6826aa
commit de46b2be07
3 changed files with 21 additions and 4 deletions
+16
View File
@@ -1125,3 +1125,19 @@ bool path_strv_contains(char **l, const char *path) {
return false;
}
bool prefixed_path_strv_contains(char **l, const char *path) {
char **i, *j;
STRV_FOREACH(i, l) {
j = *i;
if (*j == '-')
j++;
if (*j == '+')
j++;
if (path_equal(j, path))
return true;
}
return false;
}