tree-wide: replace strjoin() with path_join()

This commit is contained in:
Yu Watanabe
2019-06-21 03:26:16 +09:00
parent f9dc94408d
commit 657ee2d82b
44 changed files with 90 additions and 119 deletions
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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
View File
@@ -348,7 +348,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;
@@ -482,7 +482,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;
@@ -570,13 +570,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;
@@ -592,11 +592,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;
@@ -623,7 +623,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;
@@ -1227,7 +1227,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;
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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;
+2 -5
View File
@@ -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;
+1 -1
View File
@@ -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;