summaryrefslogtreecommitdiff
path: root/src/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-08-01 02:45:51 +0200
committerLennart Poettering <lennart@poettering.net>2011-08-01 02:45:51 +0200
commitcd0ed1db9b58900959866e7b265fae2b153b68c0 (patch)
tree5244252e3b4d3372f3d9c0e094a7063941d8b395 /src/unit.c
parent44d91056924e1e64699892f71121b40c46489e57 (diff)
util: more join() optimizations
Diffstat (limited to 'src/unit.c')
-rw-r--r--src/unit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/unit.c b/src/unit.c
index e494834a61..65ee0cc35f 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1772,22 +1772,22 @@ int unit_add_cgroup(Unit *u, CGroupBonding *b) {
static char *default_cgroup_path(Unit *u) {
char *p;
- int r;
assert(u);
if (u->meta.instance) {
char *t;
- if (!(t = unit_name_template(u->meta.id)))
+ t = unit_name_template(u->meta.id);
+ if (!t)
return NULL;
- r = asprintf(&p, "%s/%s/%s", u->meta.manager->cgroup_hierarchy, t, u->meta.instance);
+ p = join(u->meta.manager->cgroup_hierarchy, "/", t, "/", u->meta.instance, NULL);
free(t);
} else
- r = asprintf(&p, "%s/%s", u->meta.manager->cgroup_hierarchy, u->meta.id);
+ p = join(u->meta.manager->cgroup_hierarchy, "/", u->meta.id, NULL);
- return r < 0 ? NULL : p;
+ return p;
}
int unit_add_cgroup_from_text(Unit *u, const char *name) {