diff --git a/src/basic/path-util.c b/src/basic/path-util.c index f59d4286273..8150e06c4c4 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -1308,7 +1308,7 @@ bool valid_device_node_path(const char *path) { if (!PATH_STARTSWITH_SET(path, "/dev/", "/run/systemd/inaccessible/")) return false; - if (endswith(path, "/")) /* can't be a device node if it ends in a slash */ + if (path_implies_directory(path)) /* can't be a device node if it must be a directory */ return false; return path_is_normalized(path); diff --git a/src/basic/user-util.c b/src/basic/user-util.c index 9442cf64e05..8298c67a598 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -915,7 +915,7 @@ bool valid_shell(const char *p) { if (!valid_home(p)) return false; - return !endswith(p, "/"); /* one additional restriction: shells may not be dirs */ + return !path_implies_directory(p); /* one additional restriction: shells may not be dirs */ } int maybe_setgroups(size_t size, const gid_t *list) { diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index be52e8a6906..7109682f838 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -172,8 +172,8 @@ static int mangle_path( return -ENOMEM; /* We only reference files, never directories */ - if (endswith(c, "/")) { - log_syntax(NULL, LOG_WARNING, fname, line, 0, "Path in field '%s' has trailing slash, ignoring: %s", field, c); + if (path_implies_directory(c)) { + log_syntax(NULL, LOG_WARNING, fname, line, 0, "Path in field '%s' refers to a directory, ignoring: %s", field, c); *ret = NULL; return 0; }