Merge pull request #12836 from yuwata/tree-wide-replace-strjoin
tree-wide: replace strjoin() with path_join()
This commit is contained in:
@@ -115,11 +115,11 @@ int block_get_originating(dev_t dt, dev_t *ret) {
|
||||
* setups, however, only if both partitions are on the same physical device. Hence, let's
|
||||
* verify this. */
|
||||
|
||||
u = strjoin(p, "/", de->d_name, "/../dev");
|
||||
u = path_join(p, de->d_name, "../dev");
|
||||
if (!u)
|
||||
return -ENOMEM;
|
||||
|
||||
v = strjoin(p, "/", found->d_name, "/../dev");
|
||||
v = path_join(p, found->d_name, "../dev");
|
||||
if (!v)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -1530,7 +1530,7 @@ static int subvol_snapshot_children(
|
||||
if (old_child_fd < 0)
|
||||
return -errno;
|
||||
|
||||
np = strjoin(subvolume, "/", ino_args.name);
|
||||
np = path_join(subvolume, ino_args.name);
|
||||
if (!np)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+11
-11
@@ -388,7 +388,7 @@ int cg_kill_recursive(
|
||||
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)
|
||||
return -ENOMEM;
|
||||
@@ -522,7 +522,7 @@ int cg_migrate_recursive(
|
||||
while ((r = cg_read_subgroup(d, &fn)) > 0) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = strjoin(pfrom, "/", fn);
|
||||
p = path_join(pfrom, fn);
|
||||
free(fn);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
@@ -610,13 +610,13 @@ static int join_path_legacy(const char *controller, const char *path, const char
|
||||
dn = controller_to_dirname(controller);
|
||||
|
||||
if (isempty(path) && isempty(suffix))
|
||||
t = strappend("/sys/fs/cgroup/", dn);
|
||||
t = path_join("/sys/fs/cgroup", dn);
|
||||
else if (isempty(path))
|
||||
t = strjoin("/sys/fs/cgroup/", dn, "/", suffix);
|
||||
t = path_join("/sys/fs/cgroup", dn, suffix);
|
||||
else if (isempty(suffix))
|
||||
t = strjoin("/sys/fs/cgroup/", dn, "/", path);
|
||||
t = path_join("/sys/fs/cgroup", dn, path);
|
||||
else
|
||||
t = strjoin("/sys/fs/cgroup/", dn, "/", path, "/", suffix);
|
||||
t = path_join("/sys/fs/cgroup", dn, path, suffix);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -632,11 +632,11 @@ static int join_path_unified(const char *path, const char *suffix, char **fs) {
|
||||
if (isempty(path) && isempty(suffix))
|
||||
t = strdup("/sys/fs/cgroup");
|
||||
else if (isempty(path))
|
||||
t = strappend("/sys/fs/cgroup/", suffix);
|
||||
t = path_join("/sys/fs/cgroup", suffix);
|
||||
else if (isempty(suffix))
|
||||
t = strappend("/sys/fs/cgroup/", path);
|
||||
t = path_join("/sys/fs/cgroup", path);
|
||||
else
|
||||
t = strjoin("/sys/fs/cgroup/", path, "/", suffix);
|
||||
t = path_join("/sys/fs/cgroup", path, suffix);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -663,7 +663,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
|
||||
else if (!path)
|
||||
t = strdup(suffix);
|
||||
else
|
||||
t = strjoin(path, "/", suffix);
|
||||
t = path_join(path, suffix);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1267,7 +1267,7 @@ int cg_is_empty_recursive(const char *controller, 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)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -115,7 +115,7 @@ static int files_add(
|
||||
|
||||
key = p;
|
||||
} else {
|
||||
p = strjoin(dirpath, "/", de->d_name);
|
||||
p = path_join(dirpath, de->d_name);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
+1
-1
@@ -566,7 +566,7 @@ static int fd_copy_directory(
|
||||
|
||||
if (progress_path) {
|
||||
if (display_path)
|
||||
child_display_path = dp = strjoin(display_path, "/", de->d_name);
|
||||
child_display_path = dp = path_join(display_path, de->d_name);
|
||||
else
|
||||
child_display_path = de->d_name;
|
||||
|
||||
|
||||
+1
-4
@@ -589,10 +589,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
|
||||
_cleanup_free_ char *p = NULL;
|
||||
FILE *f;
|
||||
|
||||
if (root)
|
||||
p = strjoin(root, *i, "/", path);
|
||||
else
|
||||
p = strjoin(*i, "/", path);
|
||||
p = path_join(root, *i, path);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -68,10 +68,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
|
||||
if (path_is_absolute(p) || isempty(prefix))
|
||||
return strdup(p);
|
||||
|
||||
if (endswith(prefix, "/"))
|
||||
return strjoin(prefix, p);
|
||||
else
|
||||
return strjoin(prefix, "/", p);
|
||||
return path_join(prefix, p);
|
||||
}
|
||||
|
||||
int safe_getcwd(char **ret) {
|
||||
@@ -581,7 +578,7 @@ int find_binary(const char *name, char **ret) {
|
||||
if (!path_is_absolute(element))
|
||||
continue;
|
||||
|
||||
j = strjoin(element, "/", name);
|
||||
j = path_join(element, name);
|
||||
if (!j)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ int mkdtemp_malloc(const char *template, char **ret) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
p = strjoin(tmp, "/XXXXXX");
|
||||
p = path_join(tmp, "XXXXXX");
|
||||
}
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user