mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: clean what an e entry with a glob matches
An e entry takes a glob, but cleaning looked for a directory with
the pattern as its name:
e /var/cache/* - - - 10d
tmpfiles --clean t.conf
This cleaned nothing.
Expand the glob and clean each directory it matches. Also use the
age of a C entry, tmpfiles.d(5) has it clean what it copied.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+16
-6
No files matched your search
+7
-3
@@ -1198,11 +1198,15 @@ static void tmpfiles(char *line)
|
||||
}
|
||||
|
||||
/* age-based cleanup logic */
|
||||
if (clean_flag && strchr("dDe", type[0]) && !parse_age(age, &clean_age)) {
|
||||
if (clean_flag && strchr("CdDe", type[0]) && !parse_age(age, &clean_age)) {
|
||||
clean_now = time(NULL);
|
||||
|
||||
/* Nothing is older than the epoch */
|
||||
if (clean_age.sec <= clean_now)
|
||||
/* Only e takes a glob, and nothing is older than the epoch */
|
||||
if (clean_age.sec > clean_now)
|
||||
;
|
||||
else if (type[0] == 'e')
|
||||
glob_do(path, clean_dir);
|
||||
else
|
||||
clean_dir(path);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user