X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Funit.c;h=b3b0892f5ebaa1bb0545376776cd8331e605145c;hb=adb76a701d870b980f7949bcfece2c1547b4976d;hp=43280ecd2f59a8d85afdd4fd33f214b7d79964c5;hpb=dd5ae4c36c89da5dbe8d1628939b26c00db98753;p=elogind.git diff --git a/src/core/unit.c b/src/core/unit.c index 43280ecd2..b3b0892f5 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3272,7 +3272,7 @@ static int unit_drop_in_file(Unit *u, int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *data) { - _cleanup_free_ char *dir = NULL; + _cleanup_free_ char *dir = NULL, *p = NULL, *q = NULL; int r; assert(u); @@ -3284,7 +3284,24 @@ int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, co if (r < 0) return r; - return write_drop_in(dir, u->id, 50, name, data); + r = write_drop_in(dir, u->id, 50, name, data); + if (r < 0) + return r; + + r = drop_in_file(dir, u->id, 50, name, &p, &q); + if (r < 0) + return r; + + r = strv_extend(&u->dropin_paths, q); + if (r < 0) + return r; + + strv_sort(u->dropin_paths); + strv_uniq(u->dropin_paths); + + u->dropin_mtime = now(CLOCK_REALTIME); + + return 0; } int unit_write_drop_in_format(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *format, ...) {