util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
This commit is contained in:
parent
184850e8a7
commit
b7def68494
4
TODO
4
TODO
|
@ -34,6 +34,10 @@ Bugfixes:
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
* logind: wakelock/opportunistic suspend support
|
||||||
|
|
||||||
|
* seccomp filters for services
|
||||||
|
|
||||||
* replace BindTo= by BindsTo=, but keep old name for compat
|
* replace BindTo= by BindsTo=, but keep old name for compat
|
||||||
|
|
||||||
* switch-root: sockets need relabelling
|
* switch-root: sockets need relabelling
|
||||||
|
|
|
@ -310,7 +310,7 @@ static int refresh_one(
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
p = join(path, "/", fn, NULL);
|
p = strjoin(path, "/", fn, NULL);
|
||||||
free(fn);
|
free(fn);
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ int cgroup_bonding_install(CGroupBonding *b, pid_t pid, const char *cgroup_suffi
|
||||||
assert(pid >= 0);
|
assert(pid >= 0);
|
||||||
|
|
||||||
if (cgroup_suffix) {
|
if (cgroup_suffix) {
|
||||||
p = join(b->path, "/", cgroup_suffix, NULL);
|
p = strjoin(b->path, "/", cgroup_suffix, NULL);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ int cgroup_bonding_kill(CGroupBonding *b, int sig, bool sigcont, bool rem, Set *
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (cgroup_suffix) {
|
if (cgroup_suffix) {
|
||||||
p = join(b->path, "/", cgroup_suffix, NULL);
|
p = strjoin(b->path, "/", cgroup_suffix, NULL);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
|
||||||
else {
|
else {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = join(switch_root, "/", switch_root_init, NULL);
|
p = strjoin(switch_root, "/", switch_root_init, NULL);
|
||||||
if (!p)
|
if (!p)
|
||||||
goto oom;
|
goto oom;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int iterate_dir(Unit *u, const char *path, UnitDependency dependency) {
|
||||||
if (ignore_file(de->d_name))
|
if (ignore_file(de->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
f = join(path, "/", de->d_name, NULL);
|
f = strjoin(path, "/", de->d_name, NULL);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -80,7 +80,7 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c
|
||||||
assert(name);
|
assert(name);
|
||||||
assert(suffix);
|
assert(suffix);
|
||||||
|
|
||||||
path = join(unit_path, "/", name, suffix, NULL);
|
path = strjoin(unit_path, "/", name, suffix, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c
|
||||||
if (!template)
|
if (!template)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
path = join(unit_path, "/", template, suffix, NULL);
|
path = strjoin(unit_path, "/", template, suffix, NULL);
|
||||||
free(template);
|
free(template);
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
|
|
|
@ -590,7 +590,7 @@ static void manager_build_unit_path_cache(Manager *m) {
|
||||||
if (ignore_file(de->d_name))
|
if (ignore_file(de->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p = join(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
|
p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -2085,7 +2085,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = join("/tmp/systemd-", name, ".XXXXXX", NULL);
|
p = strjoin("/tmp/systemd-", name, ".XXXXXX", NULL);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -1534,7 +1534,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
|
||||||
goto clean_up;
|
goto clean_up;
|
||||||
}
|
}
|
||||||
|
|
||||||
o = join(options, ",", options2, NULL);
|
o = strjoin(options, ",", options2, NULL);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -722,7 +722,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
|
||||||
char *d = NULL;
|
char *d = NULL;
|
||||||
|
|
||||||
if (chkconfig_description)
|
if (chkconfig_description)
|
||||||
d = join(chkconfig_description, " ", j, NULL);
|
d = strjoin(chkconfig_description, " ", j, NULL);
|
||||||
else
|
else
|
||||||
d = strdup(j);
|
d = strdup(j);
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
|
||||||
char *d = NULL;
|
char *d = NULL;
|
||||||
|
|
||||||
if (long_description)
|
if (long_description)
|
||||||
d = join(long_description, " ", t, NULL);
|
d = strjoin(long_description, " ", t, NULL);
|
||||||
else
|
else
|
||||||
d = strdup(j);
|
d = strdup(j);
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
||||||
char *path;
|
char *path;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
path = join(*p, "/", name, NULL);
|
path = strjoin(*p, "/", name, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1023,7 +1023,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
||||||
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
|
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
|
||||||
/* Try SUSE style boot.* init scripts */
|
/* Try SUSE style boot.* init scripts */
|
||||||
|
|
||||||
path = join(*p, "/boot.", name, NULL);
|
path = strjoin(*p, "/boot.", name, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
||||||
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
|
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
|
||||||
/* Try Frugalware style rc.* init scripts */
|
/* Try Frugalware style rc.* init scripts */
|
||||||
|
|
||||||
path = join(*p, "/rc.", name, NULL);
|
path = strjoin(*p, "/rc.", name, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -3407,7 +3407,7 @@ static int service_enumerate(Manager *m) {
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
path = join(*p, "/", rcnd_table[i].path, NULL);
|
path = strjoin(*p, "/", rcnd_table[i].path, NULL);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -3442,7 +3442,7 @@ static int service_enumerate(Manager *m) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
free(fpath);
|
free(fpath);
|
||||||
fpath = join(path, "/", de->d_name, NULL);
|
fpath = strjoin(path, "/", de->d_name, NULL);
|
||||||
if (!fpath) {
|
if (!fpath) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -1891,10 +1891,10 @@ static char *default_cgroup_path(Unit *u) {
|
||||||
if (!t)
|
if (!t)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = join(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL);
|
p = strjoin(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL);
|
||||||
free(t);
|
free(t);
|
||||||
} else
|
} else
|
||||||
p = join(u->manager->cgroup_hierarchy, "/", u->id, NULL);
|
p = strjoin(u->manager->cgroup_hierarchy, "/", u->id, NULL);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ static int create_disk(
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = join(arg_dest, "/", n, NULL);
|
p = strjoin(arg_dest, "/", n, NULL);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
log_error("Failed to allocate unit file name.");
|
log_error("Failed to allocate unit file name.");
|
||||||
|
@ -175,7 +175,7 @@ static int create_disk(
|
||||||
|
|
||||||
if (!noauto) {
|
if (!noauto) {
|
||||||
|
|
||||||
to = join(arg_dest, "/", d, ".wants/", n, NULL);
|
to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
|
||||||
if (!to) {
|
if (!to) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -191,9 +191,9 @@ static int create_disk(
|
||||||
free(to);
|
free(to);
|
||||||
|
|
||||||
if (!nofail)
|
if (!nofail)
|
||||||
to = join(arg_dest, "/cryptsetup.target.requires/", n, NULL);
|
to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL);
|
||||||
else
|
else
|
||||||
to = join(arg_dest, "/cryptsetup.target.wants/", n, NULL);
|
to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL);
|
||||||
if (!to) {
|
if (!to) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -211,7 +211,7 @@ static int create_disk(
|
||||||
}
|
}
|
||||||
|
|
||||||
e = unit_name_escape(name);
|
e = unit_name_escape(name);
|
||||||
to = join(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL);
|
to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL);
|
||||||
if (!to) {
|
if (!to) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -192,7 +192,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, const char *path) {
|
||||||
if (!dirent_is_file(de))
|
if (!dirent_is_file(de))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p = join(path, "/", de->d_name, NULL);
|
p = strjoin(path, "/", de->d_name, NULL);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -254,7 +254,7 @@ static int process_suffix(const char *prefixes, const char *suffix) {
|
||||||
NULSTR_FOREACH(p, prefixes) {
|
NULSTR_FOREACH(p, prefixes) {
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
t = join(p, "/", suffix, NULL);
|
t = strjoin(p, "/", suffix, NULL);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static int add_swap(const char *what, struct mntent *me) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
unit = join(arg_dest, "/", name, NULL);
|
unit = strjoin(arg_dest, "/", name, NULL);
|
||||||
if (!unit) {
|
if (!unit) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -146,7 +146,7 @@ static int add_swap(const char *what, struct mntent *me) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noauto) {
|
if (!noauto) {
|
||||||
lnk = join(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
|
lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -169,7 +169,7 @@ static int add_swap(const char *what, struct mntent *me) {
|
||||||
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
free(lnk);
|
free(lnk);
|
||||||
lnk = join(arg_dest, "/", device, ".wants/", name, NULL);
|
lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL);
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -261,7 +261,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
unit = join(arg_dest, "/", name, NULL);
|
unit = strjoin(arg_dest, "/", name, NULL);
|
||||||
if (!unit) {
|
if (!unit) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -321,7 +321,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noauto) {
|
if (!noauto) {
|
||||||
lnk = join(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
|
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -347,7 +347,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
|
||||||
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
free(lnk);
|
free(lnk);
|
||||||
lnk = join(arg_dest, "/", device, ".wants/", name, NULL);
|
lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL);
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -372,7 +372,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
automount_unit = join(arg_dest, "/", automount_name, NULL);
|
automount_unit = strjoin(arg_dest, "/", automount_name, NULL);
|
||||||
if (!automount_unit) {
|
if (!automount_unit) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
@ -408,7 +408,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
|
||||||
}
|
}
|
||||||
|
|
||||||
free(lnk);
|
free(lnk);
|
||||||
lnk = join(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);
|
lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
|
|
@ -39,7 +39,7 @@ static int add_symlink(const char *fservice, const char *tservice) {
|
||||||
assert(tservice);
|
assert(tservice);
|
||||||
|
|
||||||
from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice);
|
from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice);
|
||||||
to = join(arg_dest,"/getty.target.wants/", tservice, NULL);
|
to = strjoin(arg_dest,"/getty.target.wants/", tservice, NULL);
|
||||||
|
|
||||||
if (!from || !to) {
|
if (!from || !to) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
|
|
|
@ -213,14 +213,14 @@ int main(int argc, char* argv[]) {
|
||||||
IOVEC_SET_STRING(iovec[j++], core_cmdline);
|
IOVEC_SET_STRING(iovec[j++], core_cmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
core_timestamp = join("COREDUMP_TIMESTAMP=", argv[ARG_TIMESTAMP], "000000", NULL);
|
core_timestamp = strjoin("COREDUMP_TIMESTAMP=", argv[ARG_TIMESTAMP], "000000", NULL);
|
||||||
if (core_timestamp)
|
if (core_timestamp)
|
||||||
IOVEC_SET_STRING(iovec[j++], core_timestamp);
|
IOVEC_SET_STRING(iovec[j++], core_timestamp);
|
||||||
|
|
||||||
IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
|
IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
|
||||||
IOVEC_SET_STRING(iovec[j++], "PRIORITY=2");
|
IOVEC_SET_STRING(iovec[j++], "PRIORITY=2");
|
||||||
|
|
||||||
core_message = join("MESSAGE=Process ", argv[ARG_PID], " (", argv[ARG_COMM], ") dumped core.", NULL);
|
core_message = strjoin("MESSAGE=Process ", argv[ARG_PID], " (", argv[ARG_COMM], ") dumped core.", NULL);
|
||||||
if (core_message)
|
if (core_message)
|
||||||
IOVEC_SET_STRING(iovec[j++], core_message);
|
IOVEC_SET_STRING(iovec[j++], core_message);
|
||||||
|
|
||||||
|
|
|
@ -1976,7 +1976,7 @@ static int system_journal_open(Server *s) {
|
||||||
(void) mkdir(fn, 0755);
|
(void) mkdir(fn, 0755);
|
||||||
free(fn);
|
free(fn);
|
||||||
|
|
||||||
fn = join("/var/log/journal/", ids, "/system.journal", NULL);
|
fn = strjoin("/var/log/journal/", ids, "/system.journal", NULL);
|
||||||
if (!fn)
|
if (!fn)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -2002,7 +2002,7 @@ static int system_journal_open(Server *s) {
|
||||||
if (!s->runtime_journal &&
|
if (!s->runtime_journal &&
|
||||||
(s->storage != STORAGE_NONE)) {
|
(s->storage != STORAGE_NONE)) {
|
||||||
|
|
||||||
fn = join("/run/log/journal/", ids, "/system.journal", NULL);
|
fn = strjoin("/run/log/journal/", ids, "/system.journal", NULL);
|
||||||
if (!fn)
|
if (!fn)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ static char *match_make_string(Match *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
k = join(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
|
k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
|
||||||
free(p);
|
free(p);
|
||||||
free(t);
|
free(t);
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ static char *match_make_string(Match *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enclose) {
|
if (enclose) {
|
||||||
r = join("(", p, ")", NULL);
|
r = strjoin("(", p, ")", NULL);
|
||||||
free(p);
|
free(p);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1101,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) {
|
||||||
(startswith(filename, "system@") && endswith(filename, ".journal"))))
|
(startswith(filename, "system@") && endswith(filename, ".journal"))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
path = join(prefix, "/", filename, NULL);
|
path = strjoin(prefix, "/", filename, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1149,7 +1149,7 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
|
||||||
assert(prefix);
|
assert(prefix);
|
||||||
assert(filename);
|
assert(filename);
|
||||||
|
|
||||||
path = join(prefix, "/", filename, NULL);
|
path = strjoin(prefix, "/", filename, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1184,7 +1184,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
|
||||||
!sd_id128_equal(id, mid)))
|
!sd_id128_equal(id, mid)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
path = join(prefix, "/", dirname, NULL);
|
path = strjoin(prefix, "/", dirname, NULL);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -522,16 +522,16 @@ static int join_path(const char *controller, const char *path, const char *suffi
|
||||||
|
|
||||||
if (controller) {
|
if (controller) {
|
||||||
if (path && suffix)
|
if (path && suffix)
|
||||||
t = join("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
|
t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
|
||||||
else if (path)
|
else if (path)
|
||||||
t = join("/sys/fs/cgroup/", controller, "/", path, NULL);
|
t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL);
|
||||||
else if (suffix)
|
else if (suffix)
|
||||||
t = join("/sys/fs/cgroup/", controller, "/", suffix, NULL);
|
t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL);
|
||||||
else
|
else
|
||||||
t = join("/sys/fs/cgroup/", controller, NULL);
|
t = strjoin("/sys/fs/cgroup/", controller, NULL);
|
||||||
} else {
|
} else {
|
||||||
if (path && suffix)
|
if (path && suffix)
|
||||||
t = join(path, "/", suffix, NULL);
|
t = strjoin(path, "/", suffix, NULL);
|
||||||
else if (path)
|
else if (path)
|
||||||
t = strdup(path);
|
t = strdup(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ int config_item_perf_lookup(
|
||||||
else {
|
else {
|
||||||
char *key;
|
char *key;
|
||||||
|
|
||||||
key = join(section, ".", lvalue, NULL);
|
key = strjoin(section, ".", lvalue, NULL);
|
||||||
if (!key)
|
if (!key)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int rtc_open(int flags) {
|
||||||
if (ignore_file(de->d_name))
|
if (ignore_file(de->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p = join("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
|
p = strjoin("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
closedir(d);
|
closedir(d);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -120,7 +120,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
|
||||||
if (path_is_absolute(p) || !prefix)
|
if (path_is_absolute(p) || !prefix)
|
||||||
return strdup(p);
|
return strdup(p);
|
||||||
|
|
||||||
return join(prefix, "/", p, NULL);
|
return strjoin(prefix, "/", p, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *path_make_absolute_cwd(const char *p) {
|
char *path_make_absolute_cwd(const char *p) {
|
||||||
|
|
|
@ -208,7 +208,7 @@ char *unit_name_build(const char *prefix, const char *instance, const char *suff
|
||||||
if (!instance)
|
if (!instance)
|
||||||
return strappend(prefix, suffix);
|
return strappend(prefix, suffix);
|
||||||
|
|
||||||
return join(prefix, "@", instance, suffix, NULL);
|
return strjoin(prefix, "@", instance, suffix, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *do_escape_char(char c, char *t) {
|
static char *do_escape_char(char c, char *t) {
|
||||||
|
@ -425,7 +425,7 @@ char *unit_name_from_path_instance(const char *prefix, const char *path, const c
|
||||||
if (!p)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r = join(prefix, "@", p, suffix, NULL);
|
r = strjoin(prefix, "@", p, suffix, NULL);
|
||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
|
||||||
if (h < 0)
|
if (h < 0)
|
||||||
return h;
|
return h;
|
||||||
|
|
||||||
r = join("[", t, "]", NULL);
|
r = strjoin("[", t, "]", NULL);
|
||||||
free(t);
|
free(t);
|
||||||
|
|
||||||
if (!r)
|
if (!r)
|
||||||
|
@ -5145,7 +5145,7 @@ finish:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *join(const char *x, ...) {
|
char *strjoin(const char *x, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
size_t l;
|
size_t l;
|
||||||
char *r, *p;
|
char *r, *p;
|
||||||
|
|
|
@ -451,7 +451,7 @@ int dirent_ensure_type(DIR *d, struct dirent *de);
|
||||||
int in_search_path(const char *path, char **search);
|
int in_search_path(const char *path, char **search);
|
||||||
int get_files_in_directory(const char *path, char ***list);
|
int get_files_in_directory(const char *path, char ***list);
|
||||||
|
|
||||||
char *join(const char *x, ...) _sentinel_;
|
char *strjoin(const char *x, ...) _sentinel_;
|
||||||
|
|
||||||
bool is_main_thread(void);
|
bool is_main_thread(void);
|
||||||
|
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ static char *resolve_fragment(const char *fragment, const char **search_paths) {
|
||||||
return strdup(fragment);
|
return strdup(fragment);
|
||||||
|
|
||||||
STRV_FOREACH(p, search_paths) {
|
STRV_FOREACH(p, search_paths) {
|
||||||
resolved_path = join(*p, "/", fragment, NULL);
|
resolved_path = strjoin(*p, "/", fragment, NULL);
|
||||||
if (resolved_path == NULL) {
|
if (resolved_path == NULL) {
|
||||||
log_error("Out of memory");
|
log_error("Out of memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue