Merge pull request #12836 from yuwata/tree-wide-replace-strjoin
tree-wide: replace strjoin() with path_join()
This commit is contained in:
+2
-6
@@ -1617,11 +1617,7 @@ char *unit_default_cgroup_path(const Unit *u) {
|
||||
if (!escaped)
|
||||
return NULL;
|
||||
|
||||
if (slice)
|
||||
return strjoin(u->manager->cgroup_root, "/", slice, "/",
|
||||
escaped);
|
||||
else
|
||||
return strjoin(u->manager->cgroup_root, "/", escaped);
|
||||
return path_join(empty_to_root(u->manager->cgroup_root), slice, escaped);
|
||||
}
|
||||
|
||||
int unit_set_cgroup_path(Unit *u, const char *path) {
|
||||
@@ -2475,7 +2471,7 @@ static int unit_watch_pids_in_path(Unit *u, const char *path) {
|
||||
while ((r = cg_read_subgroup(d, &fn)) > 0) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = strjoin(path, "/", fn);
|
||||
p = path_join(path, fn);
|
||||
free(fn);
|
||||
|
||||
if (!p)
|
||||
|
||||
@@ -349,7 +349,7 @@ static int bus_service_set_transient_property(
|
||||
if (e) {
|
||||
char *z;
|
||||
|
||||
z = strjoin("/run/", e);
|
||||
z = path_join("/run", e);
|
||||
if (!z)
|
||||
return log_oom();
|
||||
|
||||
|
||||
@@ -956,7 +956,7 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) {
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
j = strjoin(p, "/", g);
|
||||
j = path_join(p, g);
|
||||
if (!j)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+7
-7
@@ -2334,7 +2334,7 @@ static int compile_bind_mounts(
|
||||
* directory. For that we overmount the usually inaccessible "private" subdirectory with a
|
||||
* tmpfs that makes it accessible and is empty except for the submounts we do this for. */
|
||||
|
||||
private_root = strjoin(params->prefix[t], "/private");
|
||||
private_root = path_join(params->prefix[t], "private");
|
||||
if (!private_root) {
|
||||
r = -ENOMEM;
|
||||
goto finish;
|
||||
@@ -2350,9 +2350,9 @@ static int compile_bind_mounts(
|
||||
|
||||
if (context->dynamic_user &&
|
||||
!IN_SET(t, EXEC_DIRECTORY_RUNTIME, EXEC_DIRECTORY_CONFIGURATION))
|
||||
s = strjoin(params->prefix[t], "/private/", *suffix);
|
||||
s = path_join(params->prefix[t], "private", *suffix);
|
||||
else
|
||||
s = strjoin(params->prefix[t], "/", *suffix);
|
||||
s = path_join(params->prefix[t], *suffix);
|
||||
if (!s) {
|
||||
r = -ENOMEM;
|
||||
goto finish;
|
||||
@@ -2364,7 +2364,7 @@ static int compile_bind_mounts(
|
||||
/* When RootDirectory= or RootImage= are set, then the symbolic link to the private
|
||||
* directory is not created on the root directory. So, let's bind-mount the directory
|
||||
* on the 'non-private' place. */
|
||||
d = strjoin(params->prefix[t], "/", *suffix);
|
||||
d = path_join(params->prefix[t], *suffix);
|
||||
else
|
||||
d = strdup(s);
|
||||
if (!d) {
|
||||
@@ -2800,9 +2800,9 @@ static int compile_suggested_paths(const ExecContext *c, const ExecParameters *p
|
||||
char *e;
|
||||
|
||||
if (t == EXEC_DIRECTORY_RUNTIME)
|
||||
e = strjoin(p->prefix[t], "/", *i);
|
||||
e = path_join(p->prefix[t], *i);
|
||||
else
|
||||
e = strjoin(p->prefix[t], "/private/", *i);
|
||||
e = path_join(p->prefix[t], "private", *i);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -2840,7 +2840,7 @@ static int exec_parameters_get_cgroup_path(const ExecParameters *params, char **
|
||||
|
||||
using_subcgroup = FLAGS_SET(params->flags, EXEC_CONTROL_CGROUP|EXEC_CGROUP_DELEGATE|EXEC_IS_CONTROL);
|
||||
if (using_subcgroup)
|
||||
p = strjoin(params->cgroup_path, "/.control");
|
||||
p = path_join(params->cgroup_path, ".control");
|
||||
else
|
||||
p = strdup(params->cgroup_path);
|
||||
if (!p)
|
||||
|
||||
@@ -676,7 +676,7 @@ int config_parse_exec(
|
||||
NULSTR_FOREACH(prefix, DEFAULT_PATH_NULSTR) {
|
||||
_cleanup_free_ char *fullpath = NULL;
|
||||
|
||||
fullpath = strjoin(prefix, "/", path);
|
||||
fullpath = path_join(prefix, path);
|
||||
if (!fullpath)
|
||||
return log_oom();
|
||||
|
||||
|
||||
+1
-1
@@ -328,7 +328,7 @@ static int parse_confirm_spawn(const char *value, char **console) {
|
||||
else if (is_path(value)) /* on with fully qualified path */
|
||||
s = strdup(value);
|
||||
else /* on with only a tty file name, not a fully qualified path */
|
||||
s = strjoin("/dev/", value);
|
||||
s = path_join("/dev", value);
|
||||
if (!s)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+1
-1
@@ -1483,7 +1483,7 @@ static void manager_build_unit_path_cache(Manager *m) {
|
||||
FOREACH_DIRENT(de, d, r = -errno; goto fail) {
|
||||
char *p;
|
||||
|
||||
p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name);
|
||||
p = path_join(*i, de->d_name);
|
||||
if (!p) {
|
||||
r = -ENOMEM;
|
||||
goto fail;
|
||||
|
||||
+2
-2
@@ -1005,7 +1005,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
|
||||
STRV_FOREACH(dp, c->directories[dt].paths) {
|
||||
_cleanup_free_ char *p;
|
||||
|
||||
p = strjoin(u->manager->prefix[dt], "/", *dp);
|
||||
p = path_join(u->manager->prefix[dt], *dp);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -4520,7 +4520,7 @@ int unit_make_transient(Unit *u) {
|
||||
|
||||
(void) mkdir_p_label(u->manager->lookup_paths.transient, 0755);
|
||||
|
||||
path = strjoin(u->manager->lookup_paths.transient, "/", u->id);
|
||||
path = path_join(u->manager->lookup_paths.transient, u->id);
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user