chiark / gitweb /
units: for all unit settings that take lists, allow the empty string for resetting...
[elogind.git] / src / core / path.c
index 767620ba754bb2f42184c0acd42fe0a4e083cbf8..3775577bcf87031b27682f265536b858d040f8b6 100644 (file)
@@ -248,22 +248,28 @@ static void path_init(Unit *u) {
         p->directory_mode = 0755;
 }
 
         p->directory_mode = 0755;
 }
 
-static void path_done(Unit *u) {
-        Path *p = PATH(u);
+void path_free_specs(Path *p) {
         PathSpec *s;
 
         assert(p);
 
         PathSpec *s;
 
         assert(p);
 
-        unit_ref_unset(&p->unit);
-
         while ((s = p->specs)) {
         while ((s = p->specs)) {
-                path_spec_unwatch(s, u);
+                path_spec_unwatch(s, UNIT(p));
                 LIST_REMOVE(PathSpec, spec, p->specs, s);
                 path_spec_done(s);
                 free(s);
         }
 }
 
                 LIST_REMOVE(PathSpec, spec, p->specs, s);
                 path_spec_done(s);
                 free(s);
         }
 }
 
+static void path_done(Unit *u) {
+        Path *p = PATH(u);
+
+        assert(p);
+
+        unit_ref_unset(&p->unit);
+        path_free_specs(p);
+}
+
 int path_add_one_mount_link(Path *p, Mount *m) {
         PathSpec *s;
         int r;
 int path_add_one_mount_link(Path *p, Mount *m) {
         PathSpec *s;
         int r;