mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: skip an entry with a relative path
An entry with a path like tmp/file was run on the directory tmpfiles happened to be started in. tmpfiles.d(5) only has absolute paths, and systemd skips such a line. Do the same, with a warning. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+12
-4
No files matched your search
+6
-1
@@ -1628,7 +1628,7 @@ static void replace_kind(const char *path, mode_t fmt)
|
||||
struct stat st;
|
||||
|
||||
/* Nothing is removed by a path that may lead somewhere else */
|
||||
if (path[0] != '/' || strstr(path, "/./") || strstr(path, "/../"))
|
||||
if (strstr(path, "/./") || strstr(path, "/../"))
|
||||
return;
|
||||
|
||||
for (size_t len = strlen(copy); len > 1 && copy[len - 1] == '/'; len--)
|
||||
@@ -1784,6 +1784,11 @@ static void tmpfiles(char *line)
|
||||
}
|
||||
path = ptr;
|
||||
}
|
||||
if (path[0] != '/') {
|
||||
if (!quiet)
|
||||
warnx("Path is not absolute, skipping %s", path);
|
||||
return;
|
||||
}
|
||||
if (excluded(path))
|
||||
return;
|
||||
if (collect) {
|
||||
|
||||
Reference in new issue
Block a user