diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-09-27 20:31:23 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-09-27 20:31:57 +0200 |
commit | 6ccb1b44295edfbd4f7bc0211fe55ad765ef2af3 (patch) | |
tree | 344b4d6556f6f89658f943b71c85890ac31a5593 /src | |
parent | 2e7485f021e7771ba802ce2d5188a88baa63fe0e (diff) |
load-fragment: reset fragment_path if we couldn't find a unit file for it
Diffstat (limited to 'src')
-rw-r--r-- | src/load-fragment.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c index 74114c43b8..4395fb280c 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1846,10 +1846,20 @@ int unit_load_fragment(Unit *u) { } /* And now, try looking for it under the suggested (originally linked) path */ - if (u->meta.load_state == UNIT_STUB && u->meta.fragment_path) + if (u->meta.load_state == UNIT_STUB && u->meta.fragment_path) { + if ((r = load_from_path(u, u->meta.fragment_path)) < 0) return r; + if (u->meta.load_state == UNIT_STUB) { + /* Hmm, this didn't work? Then let's get rid + * of the fragment path stored for us, so that + * we don't point to an invalid location. */ + free(u->meta.fragment_path); + u->meta.fragment_path = NULL; + } + } + /* Look for a template */ if (u->meta.load_state == UNIT_STUB && u->meta.instance) { char *k; |