- if (root_dir && runtime) {
- if (asprintf(&p, "%s/run/systemd/system", root_dir) < 0)
- return -ENOMEM;
- } else if (runtime)
- p = strdup("/run/systemd/system");
- else if (root_dir) {
- if (asprintf(&p, "%s/%s", root_dir,
- SYSTEM_CONFIG_UNIT_PATH) < 0)
- return -ENOMEM;
- } else
- p = strdup(SYSTEM_CONFIG_UNIT_PATH);
-
+ if (runtime)
+ p = path_join(root_dir, "/run/systemd/system", NULL);
+ else
+ p = path_join(root_dir, SYSTEM_CONFIG_UNIT_PATH, NULL);