tmpfiles: stay on one file system when cleaning

Cleaning the directory of an entry with an age went into whatever was
mounted below it:

    d /srv - - - 10d

    tmpfiles --clean t.conf

With a disk mounted on /srv/data this removed every file on it older
than ten days.

Give nftw() FTW_MOUNT, so it stays on the file system of the directory.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:02:35 +01:00
1 parent 3c9500fc08
commit 9392f2082e
4 files changed
+47 -1

No files matched your search

+1 -1
View File
@@ -831,7 +831,7 @@ static void tmpfiles(char *line)
break;
clean_age = max_age;
clean_now = time(NULL);
nftw(path, do_clean, 20, FTW_DEPTH | FTW_PHYS);
nftw(path, do_clean, 20, FTW_DEPTH | FTW_PHYS | FTW_MOUNT);
break;
case 'x':
case 'X':