diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-03-31 00:22:33 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-03-31 00:38:50 -0400 |
commit | 3a8db9fe81b3f7faae7f09c4ac7d2c863bf0177d (patch) | |
tree | a15ff7b336472ea59899e00c08e3bb01a04b2efa /src/core/load-fragment.c | |
parent | 21b95806b88bd645a7ded8274240f37fb65ea150 (diff) |
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.
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index d078924c5b..f1a874cfdf 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3620,10 +3620,12 @@ static int load_from_path(Unit *u, const char *path) { if (fstat(fileno(f), &st) < 0) return -errno; - if (null_or_empty(&st)) + if (null_or_empty(&st)) { u->load_state = UNIT_MASKED; - else { + u->fragment_mtime = 0; + } else { u->load_state = UNIT_LOADED; + u->fragment_mtime = timespec_load(&st.st_mtim); /* Now, parse the file contents */ r = config_parse(u->id, filename, f, @@ -3638,8 +3640,6 @@ static int load_from_path(Unit *u, const char *path) { u->fragment_path = filename; filename = NULL; - u->fragment_mtime = timespec_load(&st.st_mtim); - if (u->source_path) { if (stat(u->source_path, &st) >= 0) u->source_mtime = timespec_load(&st.st_mtim); |