chiark / gitweb /
load-fragment: reset fragment_path if we couldn't find a unit file for it
authorLennart Poettering <lennart@poettering.net>
Mon, 27 Sep 2010 18:31:23 +0000 (20:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Sep 2010 18:31:57 +0000 (20:31 +0200)
fixme
src/load-fragment.c

diff --git a/fixme b/fixme
index 89e279bc85a1dcdf9f9112d5a5a993b806d39721..ec69ec526fe3467a22ce8ad88073dc2340b4d277 100644 (file)
--- a/fixme
+++ b/fixme
 
 * (null) dependency bug
 
-* f21781d57f7e012c1d576dfd8c30b411014c5a88
-
 * d /var/run/screen 0755 root utmp
 
 External:
index 74114c43b865a9c82e294c52fc015aaacbfd8720..4395fb280c45154a839559474c9c17ed2ba931a0 100644 (file)
@@ -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;