]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cleanvar: Be more careful when cleaning up /var.
authorXin LI <delphij@FreeBSD.org>
Mon, 13 Feb 2023 04:56:17 +0000 (20:56 -0800)
committerXin LI <delphij@FreeBSD.org>
Tue, 21 Feb 2023 15:37:30 +0000 (07:37 -0800)
commit57c37babde3664c81bc30ec5086092ae950aab49
tree9ea35cc636f28e923b916c60c9c2976903964f49
parent50796dea719a4ca2e26376eaab67eafd94532fee
cleanvar: Be more careful when cleaning up /var.

The cleanvar script uses find -delete to remove stale files under /var,
which could lead to unwanted removal of files in some unusual scenarios.
For example, when a mounted fdescfs(5) is present under /var/run/samba/fd,
find(1) could descend into a directory that is out of /var/run and remove
files that should not be removed.

To mitigate this, modify the script to use find -x, which restricts the
find scope to one file system only instead of descending into mounted
file systems.

PR: 269213
Approved by: re (cperciva)

(cherry picked from commit 39e8c2a29a860bdb69ffcfbc06de4d4ad103b458)
(cherry picked from commit 0699f0d43416776d87d20d7953b7d686f1e2e572)
libexec/rc/rc.d/cleanvar