diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-28 02:44:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-28 02:44:47 +0100 |
commit | d46de8a1a249e179687361dcaeba27e1c586253a (patch) | |
tree | 42f790e46583f88c557ac33ea67e857654a794a4 /timer.c | |
parent | 98b5b2986fa1b85fd2d2e80f867f1647b4e4e3b5 (diff) |
rework config file load logic
Diffstat (limited to 'timer.c')
-rw-r--r-- | timer.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,5 +1,7 @@ /*-*- Mode: C; c-basic-offset: 8 -*-*/ +#include <errno.h> + #include "unit.h" #include "timer.h" @@ -9,6 +11,19 @@ static void timer_done(Unit *u) { assert(t); } +static int timer_init(Unit *u) { + int r; + + assert(u); + + /* Make sure this config file actually exists */ + + if ((r = unit_load_fragment_and_dropin(u)) <= 0) + return r < 0 ? r : -ENOENT; + + return 0; +} + static UnitActiveState timer_active_state(Unit *u) { static const UnitActiveState table[_TIMER_STATE_MAX] = { @@ -23,7 +38,7 @@ static UnitActiveState timer_active_state(Unit *u) { const UnitVTable timer_vtable = { .suffix = ".timer", - .init = unit_load_fragment_and_dropin, + .init = timer_init, .done = timer_done, .active_state = timer_active_state |