From 5f4b19f4bc4b6e747ca19f53ef33a167ecf9ac0b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 15 Jun 2011 15:34:19 +0200 Subject: service: check whether sysv scripts where changed --- src/unit.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/unit.c') 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) { -- cgit v1.2.3-54-g00ecf