diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-06-15 15:34:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-06-21 19:29:45 +0200 |
commit | 5f4b19f4bc4b6e747ca19f53ef33a167ecf9ac0b (patch) | |
tree | 06c64e2b9a728fe34c8219ea5040e9b130d02849 /src/unit.c | |
parent | 8d0e38a2b966799af884e78a54fd6a2dffa44788 (diff) |
service: check whether sysv scripts where changed
Diffstat (limited to 'src/unit.c')
-rw-r--r-- | src/unit.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/unit.c b/src/unit.c index 057431c808..87b7edf145 100644 --- a/src/unit.c +++ b/src/unit.c @@ -2305,21 +2305,25 @@ void unit_status_printf(Unit *u, const char *format, ...) { } bool unit_need_daemon_reload(Unit *u) { - struct stat st; - assert(u); - if (!u->meta.fragment_path) - return false; + if (u->meta.fragment_path) { + struct stat st; - zero(st); - if (stat(u->meta.fragment_path, &st) < 0) - /* What, cannot access this anymore? */ - return true; + zero(st); + if (stat(u->meta.fragment_path, &st) < 0) + /* What, cannot access this anymore? */ + return true; - return - u->meta.fragment_mtime && - timespec_load(&st.st_mtim) != u->meta.fragment_mtime; + if (u->meta.fragment_mtime > 0 && + timespec_load(&st.st_mtim) != u->meta.fragment_mtime) + return true; + } + + if (UNIT_VTABLE(u)->need_daemon_reload) + return UNIT_VTABLE(u)->need_daemon_reload(u); + + return false; } void unit_reset_failed(Unit *u) { |