This is to match strappend() and the other string related functions.
24 files changed:
+* logind: wakelock/opportunistic suspend support
+
+* seccomp filters for services
+
* replace BindTo= by BindsTo=, but keep old name for compat
* switch-root: sockets need relabelling
* replace BindTo= by BindsTo=, but keep old name for compat
* switch-root: sockets need relabelling
- p = join(path, "/", fn, NULL);
+ p = strjoin(path, "/", fn, NULL);
assert(pid >= 0);
if (cgroup_suffix) {
assert(pid >= 0);
if (cgroup_suffix) {
- p = join(b->path, "/", cgroup_suffix, NULL);
+ p = strjoin(b->path, "/", cgroup_suffix, NULL);
return 0;
if (cgroup_suffix) {
return 0;
if (cgroup_suffix) {
- p = join(b->path, "/", cgroup_suffix, NULL);
+ p = strjoin(b->path, "/", cgroup_suffix, NULL);
- p = join(switch_root, "/", switch_root_init, NULL);
+ p = strjoin(switch_root, "/", switch_root_init, NULL);
if (ignore_file(de->d_name))
continue;
if (ignore_file(de->d_name))
continue;
- f = join(path, "/", de->d_name, NULL);
+ f = strjoin(path, "/", de->d_name, NULL);
if (!f) {
r = -ENOMEM;
goto finish;
if (!f) {
r = -ENOMEM;
goto finish;
assert(name);
assert(suffix);
assert(name);
assert(suffix);
- path = join(unit_path, "/", name, suffix, NULL);
+ path = strjoin(unit_path, "/", name, suffix, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
if (!template)
return -ENOMEM;
if (!template)
return -ENOMEM;
- path = join(unit_path, "/", template, suffix, NULL);
+ path = strjoin(unit_path, "/", template, suffix, NULL);
free(template);
if (!path)
free(template);
if (!path)
if (ignore_file(de->d_name))
continue;
if (ignore_file(de->d_name))
continue;
- p = join(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
+ p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
if (!p) {
r = -ENOMEM;
goto fail;
if (!p) {
r = -ENOMEM;
goto fail;
- p = join("/tmp/systemd-", name, ".XXXXXX", NULL);
+ p = strjoin("/tmp/systemd-", name, ".XXXXXX", NULL);
if (!p) {
log_error("Out of memory");
return -ENOMEM;
if (!p) {
log_error("Out of memory");
return -ENOMEM;
- o = join(options, ",", options2, NULL);
+ o = strjoin(options, ",", options2, NULL);
if (!o) {
r = -ENOMEM;
goto finish;
if (!o) {
r = -ENOMEM;
goto finish;
char *d = NULL;
if (chkconfig_description)
char *d = NULL;
if (chkconfig_description)
- d = join(chkconfig_description, " ", j, NULL);
+ d = strjoin(chkconfig_description, " ", j, NULL);
char *d = NULL;
if (long_description)
char *d = NULL;
if (long_description)
- d = join(long_description, " ", t, NULL);
+ d = strjoin(long_description, " ", t, NULL);
- path = join(*p, "/", name, NULL);
+ path = strjoin(*p, "/", name, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
/* Try SUSE style boot.* init scripts */
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
/* Try SUSE style boot.* init scripts */
- path = join(*p, "/boot.", name, NULL);
+ path = strjoin(*p, "/boot.", name, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
/* Try Frugalware style rc.* init scripts */
if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
/* Try Frugalware style rc.* init scripts */
- path = join(*p, "/rc.", name, NULL);
+ path = strjoin(*p, "/rc.", name, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
struct dirent *de;
free(path);
struct dirent *de;
free(path);
- path = join(*p, "/", rcnd_table[i].path, NULL);
+ path = strjoin(*p, "/", rcnd_table[i].path, NULL);
if (!path) {
r = -ENOMEM;
goto finish;
if (!path) {
r = -ENOMEM;
goto finish;
- fpath = join(path, "/", de->d_name, NULL);
+ fpath = strjoin(path, "/", de->d_name, NULL);
if (!fpath) {
r = -ENOMEM;
goto finish;
if (!fpath) {
r = -ENOMEM;
goto finish;
- p = join(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL);
+ p = strjoin(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL);
- p = join(u->manager->cgroup_hierarchy, "/", u->id, NULL);
+ p = strjoin(u->manager->cgroup_hierarchy, "/", u->id, NULL);
- p = join(arg_dest, "/", n, NULL);
+ p = strjoin(arg_dest, "/", n, NULL);
if (!p) {
r = -ENOMEM;
log_error("Failed to allocate unit file name.");
if (!p) {
r = -ENOMEM;
log_error("Failed to allocate unit file name.");
- to = join(arg_dest, "/", d, ".wants/", n, NULL);
+ to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
if (!to) {
r = -ENOMEM;
goto fail;
if (!to) {
r = -ENOMEM;
goto fail;
- to = join(arg_dest, "/cryptsetup.target.requires/", n, NULL);
+ to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL);
- to = join(arg_dest, "/cryptsetup.target.wants/", n, NULL);
+ to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL);
if (!to) {
r = -ENOMEM;
goto fail;
if (!to) {
r = -ENOMEM;
goto fail;
}
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) {
r = -ENOMEM;
goto fail;
if (!to) {
r = -ENOMEM;
goto fail;
if (!dirent_is_file(de))
continue;
if (!dirent_is_file(de))
continue;
- p = join(path, "/", de->d_name, NULL);
+ p = strjoin(path, "/", de->d_name, NULL);
if (!p) {
r = -ENOMEM;
goto finish;
if (!p) {
r = -ENOMEM;
goto finish;
NULSTR_FOREACH(p, prefixes) {
char *t;
NULSTR_FOREACH(p, prefixes) {
char *t;
- t = join(p, "/", suffix, NULL);
+ t = strjoin(p, "/", suffix, NULL);
if (!t) {
r = -ENOMEM;
goto finish;
if (!t) {
r = -ENOMEM;
goto finish;
- unit = join(arg_dest, "/", name, NULL);
+ unit = strjoin(arg_dest, "/", name, NULL);
if (!unit) {
log_error("Out of memory");
r = -ENOMEM;
if (!unit) {
log_error("Out of memory");
r = -ENOMEM;
- lnk = join(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
+ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
- lnk = join(arg_dest, "/", device, ".wants/", name, NULL);
+ lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL);
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
- unit = join(arg_dest, "/", name, NULL);
+ unit = strjoin(arg_dest, "/", name, NULL);
if (!unit) {
log_error("Out of memory");
r = -ENOMEM;
if (!unit) {
log_error("Out of memory");
r = -ENOMEM;
- lnk = join(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
+ lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
- lnk = join(arg_dest, "/", device, ".wants/", name, NULL);
+ lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL);
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
- automount_unit = join(arg_dest, "/", automount_name, NULL);
+ automount_unit = strjoin(arg_dest, "/", automount_name, NULL);
if (!automount_unit) {
log_error("Out of memory");
r = -ENOMEM;
if (!automount_unit) {
log_error("Out of memory");
r = -ENOMEM;
- lnk = join(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);
+ lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
if (!lnk) {
log_error("Out of memory");
r = -ENOMEM;
assert(tservice);
from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice);
assert(tservice);
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) {
log_error("Out of memory");
if (!from || !to) {
log_error("Out of memory");
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)
IOVEC_SET_STRING(iovec[j++], core_timestamp);
IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
IOVEC_SET_STRING(iovec[j++], "PRIORITY=2");
if (core_timestamp)
IOVEC_SET_STRING(iovec[j++], core_timestamp);
IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
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)
IOVEC_SET_STRING(iovec[j++], core_message);
if (core_message)
IOVEC_SET_STRING(iovec[j++], core_message);
(void) mkdir(fn, 0755);
free(fn);
(void) mkdir(fn, 0755);
free(fn);
- fn = join("/var/log/journal/", ids, "/system.journal", NULL);
+ fn = strjoin("/var/log/journal/", ids, "/system.journal", NULL);
if (!s->runtime_journal &&
(s->storage != STORAGE_NONE)) {
if (!s->runtime_journal &&
(s->storage != STORAGE_NONE)) {
- fn = join("/run/log/journal/", ids, "/system.journal", NULL);
+ fn = strjoin("/run/log/journal/", ids, "/system.journal", NULL);
- k = join(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
+ k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
- r = join("(", p, ")", NULL);
+ r = strjoin("(", p, ")", NULL);
(startswith(filename, "system@") && endswith(filename, ".journal"))))
return 0;
(startswith(filename, "system@") && endswith(filename, ".journal"))))
return 0;
- path = join(prefix, "/", filename, NULL);
+ path = strjoin(prefix, "/", filename, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
assert(prefix);
assert(filename);
assert(prefix);
assert(filename);
- path = join(prefix, "/", filename, NULL);
+ path = strjoin(prefix, "/", filename, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
!sd_id128_equal(id, mid)))
return 0;
!sd_id128_equal(id, mid)))
return 0;
- path = join(prefix, "/", dirname, NULL);
+ path = strjoin(prefix, "/", dirname, NULL);
if (!path)
return -ENOMEM;
if (!path)
return -ENOMEM;
if (controller) {
if (path && suffix)
if (controller) {
if (path && suffix)
- t = join("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
+ t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
- t = join("/sys/fs/cgroup/", controller, "/", path, NULL);
+ t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL);
- t = join("/sys/fs/cgroup/", controller, "/", suffix, NULL);
+ t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL);
- t = join("/sys/fs/cgroup/", controller, NULL);
+ t = strjoin("/sys/fs/cgroup/", controller, NULL);
} else {
if (path && suffix)
} else {
if (path && suffix)
- t = join(path, "/", suffix, NULL);
+ t = strjoin(path, "/", suffix, NULL);
else if (path)
t = strdup(path);
}
else if (path)
t = strdup(path);
}
- key = join(section, ".", lvalue, NULL);
+ key = strjoin(section, ".", lvalue, NULL);
if (!key)
return -ENOMEM;
if (!key)
return -ENOMEM;
if (ignore_file(de->d_name))
continue;
if (ignore_file(de->d_name))
continue;
- p = join("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
+ p = strjoin("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
if (!p) {
closedir(d);
return -ENOMEM;
if (!p) {
closedir(d);
return -ENOMEM;
if (path_is_absolute(p) || !prefix)
return strdup(p);
if (path_is_absolute(p) || !prefix)
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) {
if (!instance)
return strappend(prefix, suffix);
if (!instance)
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) {
- r = join(prefix, "@", p, suffix, NULL);
+ r = strjoin(prefix, "@", p, suffix, NULL);
- r = join("[", t, "]", NULL);
+ r = strjoin("[", t, "]", NULL);
-char *join(const char *x, ...) {
+char *strjoin(const char *x, ...) {
va_list ap;
size_t l;
char *r, *p;
va_list ap;
size_t l;
char *r, *p;
int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);
int in_search_path(const char *path, char **search);
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);
return strdup(fragment);
STRV_FOREACH(p, search_paths) {
return strdup(fragment);
STRV_FOREACH(p, search_paths) {
- resolved_path = join(*p, "/", fragment, NULL);
+ resolved_path = strjoin(*p, "/", fragment, NULL);
if (resolved_path == NULL) {
log_error("Out of memory");
return NULL;
if (resolved_path == NULL) {
log_error("Out of memory");
return NULL;