X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fload-dropin.c;h=eafcc2fdf36ec83c1a2c25dd85057f3dbb926fb5;hp=d30865cbc53789a5442d9fa76e2efab49c1ce893;hb=8112e84f657839a056afb411249a627956518b24;hpb=99f08d14a7e4210bdb97b8c9d0752ec318ecca30 diff --git a/src/load-dropin.c b/src/load-dropin.c index d30865cbc..eafcc2fdf 100644 --- a/src/load-dropin.c +++ b/src/load-dropin.c @@ -50,7 +50,8 @@ static int iterate_dir(Unit *u, const char *path, UnitDependency dependency) { if (ignore_file(de->d_name)) continue; - if (asprintf(&f, "%s/%s", path, de->d_name) < 0) { + f = join(path, "/", de->d_name, NULL); + if (!f) { r = -ENOMEM; goto finish; } @@ -78,7 +79,8 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c assert(name); assert(suffix); - if (asprintf(&path, "%s/%s%s", unit_path, name, suffix) < 0) + path = join(unit_path, "/", name, suffix, NULL); + if (!path) return -ENOMEM; if (u->meta.manager->unit_path_cache && @@ -98,10 +100,10 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c if (!(template = unit_name_template(name))) return -ENOMEM; - r = asprintf(&path, "%s/%s%s", unit_path, template, suffix); + path = join(unit_path, "/", template, suffix, NULL); free(template); - if (r < 0) + if (!path) return -ENOMEM; if (u->meta.manager->unit_path_cache &&