core: treat masked files as "unchanged"

systemctl prints the "unit file changed on disk" warning
for a masked unit. I think it's better to print nothing in that
case.

When a masked unit is loaded, set mtime as 0. When checking
if a unit with mtime of 0 needs reload, check that the mask
is still in place.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-03-31 00:38:50 -04:00
parent 21b95806b8
commit 3a8db9fe81
2 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -2934,7 +2934,11 @@ static bool fragment_mtime_changed(const char *path, usec_t mtime) {
/* What, cannot access this anymore? */
return true;
if (mtime > 0 && timespec_load(&st.st_mtim) != mtime)
if (mtime > 0)
/* For non-empty files check the mtime */
return timespec_load(&st.st_mtim) != mtime;
else if (!null_or_empty(&st))
/* For masked files check if they are still so */
return true;
return false;