summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgls/cgls.c2
-rw-r--r--src/core/busname.c2
-rw-r--r--src/core/dbus-cgroup.c2
-rw-r--r--src/core/execute.c6
-rw-r--r--src/core/machine-id-setup.c8
-rw-r--r--src/core/manager.c3
-rw-r--r--src/core/mount.c2
-rw-r--r--src/core/namespace.c22
-rw-r--r--src/core/service.c8
-rw-r--r--src/core/socket.c4
-rw-r--r--src/core/swap.c2
-rw-r--r--src/core/unit.c2
-rw-r--r--src/cryptsetup/cryptsetup-generator.c2
-rw-r--r--src/cryptsetup/cryptsetup.c4
-rw-r--r--src/dbus1-generator/dbus1-generator.c16
-rw-r--r--src/efi-boot-generator/efi-boot-generator.c6
-rw-r--r--src/firstboot/firstboot.c12
-rw-r--r--src/fstab-generator/fstab-generator.c4
-rw-r--r--src/getty-generator/getty-generator.c8
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c2
-rw-r--r--src/import/curl-util.c2
-rw-r--r--src/import/import-common.c4
-rw-r--r--src/import/import-dkr.c14
-rw-r--r--src/import/import-raw.c2
-rw-r--r--src/journal-remote/journal-remote.c2
-rw-r--r--src/journal-remote/microhttpd-util.c2
-rw-r--r--src/journal/coredump.c30
-rw-r--r--src/journal/journalctl.c2
-rw-r--r--src/journal/journald-server.c46
-rw-r--r--src/journal/journald-syslog.c6
-rw-r--r--src/journal/sd-journal.c10
-rw-r--r--src/libsystemd-terminal/idev-keyboard.c4
-rw-r--r--src/libsystemd/sd-bus/bus-control.c2
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c2
-rw-r--r--src/libsystemd/sd-bus/busctl.c4
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c2
-rw-r--r--src/libsystemd/sd-login/sd-login.c4
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/locale/localed.c2
-rw-r--r--src/login/logind-button.c2
-rw-r--r--src/login/logind-dbus.c2
-rw-r--r--src/login/logind-user.c2
-rw-r--r--src/machine/machine.c6
-rw-r--r--src/machine/machinectl.c10
-rw-r--r--src/network/networkd-link.c4
-rw-r--r--src/nspawn/nspawn.c26
-rw-r--r--src/resolve/resolved-bus.c2
-rw-r--r--src/run/run.c2
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/cgroup-util.c2
-rw-r--r--src/shared/condition.c2
-rw-r--r--src/shared/conf-files.c2
-rw-r--r--src/shared/generator.c2
-rw-r--r--src/shared/install.c4
-rw-r--r--src/shared/logs-show.c16
-rw-r--r--src/shared/machine-image.c8
-rw-r--r--src/shared/pager.c2
-rw-r--r--src/shared/path-util.c6
-rw-r--r--src/shared/switch-root.c2
-rw-r--r--src/shared/time-util.c2
-rw-r--r--src/shared/util.c6
-rw-r--r--src/shared/util.h26
-rw-r--r--src/system-update-generator/system-update-generator.c2
-rw-r--r--src/systemctl/systemctl.c6
-rw-r--r--src/sysusers/sysusers.c4
-rw-r--r--src/test/test-conf-files.c8
-rw-r--r--src/test/test-copy.c12
-rw-r--r--src/test/test-namespace.c4
-rw-r--r--src/test/test-path-lookup.c4
-rw-r--r--src/test/test-path.c4
-rw-r--r--src/test/test-tmpfiles.c2
-rw-r--r--src/test/test-util.c36
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c2
-rw-r--r--src/udev/udev-builtin-net_id.c2
-rw-r--r--src/udev/udevadm-util.c2
75 files changed, 248 insertions, 237 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index f400bccc0a..579e06de5b 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[]) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- m = strappenda("/run/systemd/machines/", arg_machine);
+ m = strjoina("/run/systemd/machines/", arg_machine);
r = parse_env_file(m, NEWLINE, "SCOPE", &scope, NULL);
if (r < 0) {
log_error_errno(r, "Failed to get machine path: %m");
diff --git a/src/core/busname.c b/src/core/busname.c
index ca9ceb8c3c..bc3a2bcb78 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -205,7 +205,7 @@ static int busname_verify(BusName *n) {
return -EINVAL;
}
- e = strappenda(n->name, ".busname");
+ e = strjoina(n->name, ".busname");
if (!unit_has_name(UNIT(n), e)) {
log_unit_error(UNIT(n)->id, "%s's Name= setting doesn't match unit name. Refusing.", UNIT(n)->id);
return -EINVAL;
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index db998345eb..4a9df06016 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -574,7 +574,7 @@ int bus_cgroup_set_property(
c->device_policy = p;
u->cgroup_realized_mask &= ~CGROUP_DEVICE;
- buf = strappenda("DevicePolicy=", policy);
+ buf = strjoina("DevicePolicy=", policy);
unit_write_drop_in_private(u, mode, name, buf);
}
diff --git a/src/core/execute.c b/src/core/execute.c
index 19d3ec0da9..874cdc7efe 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1582,9 +1582,9 @@ static int exec_child(
if (context->private_tmp && runtime) {
if (runtime->tmp_dir)
- tmp = strappenda(runtime->tmp_dir, "/tmp");
+ tmp = strjoina(runtime->tmp_dir, "/tmp");
if (runtime->var_tmp_dir)
- var = strappenda(runtime->var_tmp_dir, "/tmp");
+ var = strjoina(runtime->var_tmp_dir, "/tmp");
}
r = setup_namespace(
@@ -2588,7 +2588,7 @@ void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
assert(f);
prefix = strempty(prefix);
- prefix2 = strappenda(prefix, "\t");
+ prefix2 = strjoina(prefix, "\t");
cmd = exec_command_line(c->argv);
fprintf(f,
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
index 7e0aee6a75..d00a53246f 100644
--- a/src/core/machine-id-setup.c
+++ b/src/core/machine-id-setup.c
@@ -73,7 +73,7 @@ static int generate(char id[34], const char *root) {
if (isempty(root))
dbus_machine_id = "/var/lib/dbus/machine-id";
else
- dbus_machine_id = strappenda(root, "/var/lib/dbus/machine-id");
+ dbus_machine_id = strjoina(root, "/var/lib/dbus/machine-id");
/* First, try reading the D-Bus machine id, unless it is a symlink */
fd = open(dbus_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
@@ -199,7 +199,7 @@ int machine_id_commit(const char *root) {
else {
char *x;
- x = strappenda(root, "/etc/machine-id");
+ x = strjoina(root, "/etc/machine-id");
etc_machine_id = path_kill_slashes(x);
}
@@ -281,10 +281,10 @@ int machine_id_setup(const char *root) {
} else {
char *x;
- x = strappenda(root, "/etc/machine-id");
+ x = strjoina(root, "/etc/machine-id");
etc_machine_id = path_kill_slashes(x);
- x = strappenda(root, "/run/machine-id");
+ x = strjoina(root, "/run/machine-id");
run_machine_id = path_kill_slashes(x);
}
diff --git a/src/core/manager.c b/src/core/manager.c
index 0b24cddc5f..5fba0043e4 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2106,8 +2106,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
return;
}
- msg = strappenda("unit=", p);
-
+ msg = strjoina("unit=", p);
if (audit_log_user_comm_message(audit_fd, type, msg, "systemd", NULL, NULL, NULL, success) < 0) {
if (errno == EPERM)
/* We aren't allowed to send audit messages?
diff --git a/src/core/mount.c b/src/core/mount.c
index a0b5fda9cb..f3977e62de 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -976,7 +976,7 @@ static void mount_enter_remounting(Mount *m) {
const char *o;
if (m->parameters_fragment.options)
- o = strappenda("remount,", m->parameters_fragment.options);
+ o = strjoina("remount,", m->parameters_fragment.options);
else
o = "remount";
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 4b8dbdd0d8..4fecd32363 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -157,24 +157,24 @@ static int mount_dev(BindMount *m) {
if (!mkdtemp(temporary_mount))
return -errno;
- dev = strappenda(temporary_mount, "/dev");
+ dev = strjoina(temporary_mount, "/dev");
(void)mkdir(dev, 0755);
if (mount("tmpfs", dev, "tmpfs", MS_NOSUID|MS_STRICTATIME, "mode=755") < 0) {
r = -errno;
goto fail;
}
- devpts = strappenda(temporary_mount, "/dev/pts");
+ devpts = strjoina(temporary_mount, "/dev/pts");
(void)mkdir(devpts, 0755);
if (mount("/dev/pts", devpts, NULL, MS_BIND, NULL) < 0) {
r = -errno;
goto fail;
}
- devptmx = strappenda(temporary_mount, "/dev/ptmx");
+ devptmx = strjoina(temporary_mount, "/dev/ptmx");
symlink("pts/ptmx", devptmx);
- devshm = strappenda(temporary_mount, "/dev/shm");
+ devshm = strjoina(temporary_mount, "/dev/shm");
(void)mkdir(devshm, 01777);
r = mount("/dev/shm", devshm, NULL, MS_BIND, NULL);
if (r < 0) {
@@ -182,15 +182,15 @@ static int mount_dev(BindMount *m) {
goto fail;
}
- devmqueue = strappenda(temporary_mount, "/dev/mqueue");
+ devmqueue = strjoina(temporary_mount, "/dev/mqueue");
(void)mkdir(devmqueue, 0755);
mount("/dev/mqueue", devmqueue, NULL, MS_BIND, NULL);
- devhugepages = strappenda(temporary_mount, "/dev/hugepages");
+ devhugepages = strjoina(temporary_mount, "/dev/hugepages");
(void)mkdir(devhugepages, 0755);
mount("/dev/hugepages", devhugepages, NULL, MS_BIND, NULL);
- devlog = strappenda(temporary_mount, "/dev/log");
+ devlog = strjoina(temporary_mount, "/dev/log");
symlink("/run/systemd/journal/dev-log", devlog);
NULSTR_FOREACH(d, devnodes) {
@@ -280,7 +280,7 @@ static int mount_kdbus(BindMount *m) {
if (!mkdtemp(temporary_mount))
return log_error_errno(errno, "Failed create temp dir: %m");
- root = strappenda(temporary_mount, "/kdbus");
+ root = strjoina(temporary_mount, "/kdbus");
(void)mkdir(root, 0755);
if (mount("tmpfs", root, "tmpfs", MS_NOSUID|MS_STRICTATIME, "mode=777") < 0) {
r = -errno;
@@ -295,7 +295,7 @@ static int mount_kdbus(BindMount *m) {
goto fail;
}
- busnode = strappenda(root, "/bus");
+ busnode = strjoina(root, "/bus");
if (mknod(busnode, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0) {
log_error_errno(errno, "mknod() for %s failed: %m", busnode);
r = -errno;
@@ -566,7 +566,7 @@ static int setup_one_tmp_dir(const char *id, const char *prefix, char **path) {
RUN_WITH_UMASK(0000) {
char *y;
- y = strappenda(x, "/tmp");
+ y = strjoina(x, "/tmp");
if (mkdir(y, 0777 | S_ISVTX) < 0)
return -errno;
@@ -594,7 +594,7 @@ int setup_tmp_dirs(const char *id, char **tmp_dir, char **var_tmp_dir) {
if (r < 0) {
char *t;
- t = strappenda(a, "/tmp");
+ t = strjoina(a, "/tmp");
rmdir(t);
rmdir(a);
diff --git a/src/core/service.c b/src/core/service.c
index 15a2ed7f7e..15e29be149 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -562,7 +562,7 @@ static int service_add_extras(Service *s) {
if (r < 0)
return r;
- n = strappenda(s->bus_name, ".busname");
+ n = strjoina(s->bus_name, ".busname");
r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true);
if (r < 0)
return r;
@@ -619,7 +619,7 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
assert(s);
prefix = strempty(prefix);
- prefix2 = strappenda(prefix, "\t");
+ prefix2 = strjoina(prefix, "\t");
fprintf(f,
"%sService State: %s\n"
@@ -1123,7 +1123,7 @@ static int service_spawn(
}
if (is_control && UNIT(s)->cgroup_path) {
- path = strappenda(UNIT(s)->cgroup_path, "/control");
+ path = strjoina(UNIT(s)->cgroup_path, "/control");
cg_create(SYSTEMD_CGROUP_CONTROLLER, path);
} else
path = UNIT(s)->cgroup_path;
@@ -1489,7 +1489,7 @@ static void service_kill_control_processes(Service *s) {
if (!UNIT(s)->cgroup_path)
return;
- p = strappenda(UNIT(s)->cgroup_path, "/control");
+ p = strjoina(UNIT(s)->cgroup_path, "/control");
cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, p, SIGKILL, true, true, true, NULL);
}
diff --git a/src/core/socket.c b/src/core/socket.c
index 85f7f16e15..d3dabc85f2 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -266,7 +266,7 @@ static int socket_add_device_link(Socket *s) {
if (!s->bind_to_device || streq(s->bind_to_device, "lo"))
return 0;
- t = strappenda("/sys/subsystem/net/devices/", s->bind_to_device);
+ t = strjoina("/sys/subsystem/net/devices/", s->bind_to_device);
return unit_add_node_link(UNIT(s), t, false);
}
@@ -473,7 +473,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
assert(f);
prefix = strempty(prefix);
- prefix2 = strappenda(prefix, "\t");
+ prefix2 = strjoina(prefix, "\t");
fprintf(f,
"%sSocket State: %s\n"
diff --git a/src/core/swap.c b/src/core/swap.c
index 4fbabda568..6997921fde 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -749,7 +749,7 @@ static void swap_enter_activating(Swap *s) {
if (streq(discard, "all"))
discard_arg = "--discard";
else
- discard_arg = strappenda("--discard=", discard);
+ discard_arg = strjoina("--discard=", discard);
r = exec_command_append(s->control_command, discard_arg, NULL);
if (r < 0)
diff --git a/src/core/unit.c b/src/core/unit.c
index c3433b2c5d..2f95737da0 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -868,7 +868,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
assert(u->type >= 0);
prefix = strempty(prefix);
- prefix2 = strappenda(prefix, "\t");
+ prefix2 = strjoina(prefix, "\t");
fprintf(f,
"%s-> Unit %s:\n"
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 27b2360d24..05061c0704 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -183,7 +183,7 @@ static int create_disk(
if (ferror(f))
return log_error_errno(errno, "Failed to write file %s: %m", p);
- from = strappenda("../", n);
+ from = strjoina("../", n);
if (!noauto) {
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 26141a01b0..3f613d9b65 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -295,7 +295,7 @@ static int get_password(const char *name, usec_t until, bool accept_cached, char
if (!escaped_name)
return log_oom();
- id = strappenda("cryptsetup:", escaped_name);
+ id = strjoina("cryptsetup:", escaped_name);
r = ask_password_auto(text, "drive-harddisk", id, until, accept_cached, passwords);
if (r < 0)
@@ -309,7 +309,7 @@ static int get_password(const char *name, usec_t until, bool accept_cached, char
if (asprintf(&text, "Please enter passphrase for disk %s! (verification)", name) < 0)
return log_oom();
- id = strappenda("cryptsetup-verification:", escaped_name);
+ id = strjoina("cryptsetup-verification:", escaped_name);
r = ask_password_auto(text, "drive-harddisk", id, until, false, &passwords2);
if (r < 0)
diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c
index ca737e3d1b..2e08af2df2 100644
--- a/src/dbus1-generator/dbus1-generator.c
+++ b/src/dbus1-generator/dbus1-generator.c
@@ -164,7 +164,7 @@ static int add_dbus(const char *path, const char *fname, const char *type) {
assert(path);
assert(fname);
- p = strappenda(path, "/", fname);
+ p = strjoina(path, "/", fname);
r = config_parse(NULL, p, NULL,
"D-BUS Service\0",
config_item_table_lookup, table,
@@ -250,8 +250,8 @@ fail:
static int link_busnames_target(const char *units) {
const char *f, *t;
- f = strappenda(units, "/" SPECIAL_BUSNAMES_TARGET);
- t = strappenda(arg_dest, "/" SPECIAL_BASIC_TARGET ".wants/" SPECIAL_BUSNAMES_TARGET);
+ f = strjoina(units, "/" SPECIAL_BUSNAMES_TARGET);
+ t = strjoina(arg_dest, "/" SPECIAL_BASIC_TARGET ".wants/" SPECIAL_BUSNAMES_TARGET);
mkdir_parents_label(t, 0755);
if (symlink(f, t) < 0)
@@ -263,19 +263,19 @@ static int link_busnames_target(const char *units) {
static int link_compatibility(const char *units) {
const char *f, *t;
- f = strappenda(units, "/systemd-bus-proxyd.socket");
- t = strappenda(arg_dest, "/" SPECIAL_DBUS_SOCKET);
+ f = strjoina(units, "/systemd-bus-proxyd.socket");
+ t = strjoina(arg_dest, "/" SPECIAL_DBUS_SOCKET);
mkdir_parents_label(t, 0755);
if (symlink(f, t) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", t);
- f = strappenda(units, "/systemd-bus-proxyd.socket");
- t = strappenda(arg_dest, "/" SPECIAL_SOCKETS_TARGET ".wants/systemd-bus-proxyd.socket");
+ f = strjoina(units, "/systemd-bus-proxyd.socket");
+ t = strjoina(arg_dest, "/" SPECIAL_SOCKETS_TARGET ".wants/systemd-bus-proxyd.socket");
mkdir_parents_label(t, 0755);
if (symlink(f, t) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", t);
- t = strappenda(arg_dest, "/" SPECIAL_DBUS_SERVICE);
+ t = strjoina(arg_dest, "/" SPECIAL_DBUS_SERVICE);
if (symlink("/dev/null", t) < 0)
return log_error_errno(errno, "Failed to mask %s: %m", t);
diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c
index 99a819fe37..b3ff3a8b78 100644
--- a/src/efi-boot-generator/efi-boot-generator.c
+++ b/src/efi-boot-generator/efi-boot-generator.c
@@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- name = strappenda(arg_dest, "/boot.mount");
+ name = strjoina(arg_dest, "/boot.mount");
f = fopen(name, "wxe");
if (!f) {
log_error_errno(errno, "Failed to create mount unit file %s: %m", name);
@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- name = strappenda(arg_dest, "/boot.automount");
+ name = strjoina(arg_dest, "/boot.automount");
fclose(f);
f = fopen(name, "wxe");
if (!f) {
@@ -144,7 +144,7 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- name = strappenda(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/boot.automount");
+ name = strjoina(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/boot.automount");
mkdir_parents(name, 0755);
if (symlink("../boot.automount", name) < 0) {
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index a160c52fee..a765d6d219 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -50,7 +50,7 @@ static bool arg_copy_locale = false;
static bool arg_copy_timezone = false;
static bool arg_copy_root_password = false;
-#define prefix_roota(p) (arg_root ? (const char*) strappenda(arg_root, p) : (const char*) p)
+#define prefix_roota(p) (arg_root ? (const char*) strjoina(arg_root, p) : (const char*) p)
static void clear_string(char *x) {
@@ -271,9 +271,9 @@ static int process_locale(void) {
return r;
if (!isempty(arg_locale))
- locales[i++] = strappenda("LANG=", arg_locale);
+ locales[i++] = strjoina("LANG=", arg_locale);
if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale))
- locales[i++] = strappenda("LC_MESSAGES=", arg_locale_messages);
+ locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages);
if (i == 0)
return 0;
@@ -351,7 +351,7 @@ static int process_timezone(void) {
if (isempty(arg_timezone))
return 0;
- e = strappenda("../usr/share/zoneinfo/", arg_timezone);
+ e = strjoina("../usr/share/zoneinfo/", arg_timezone);
mkdir_parents(etc_localtime, 0755);
if (symlink(e, etc_localtime) < 0)
@@ -460,8 +460,8 @@ static int prompt_root_password(void) {
print_welcome();
putchar('\n');
- msg1 = strappenda(draw_special_char(DRAW_TRIANGULAR_BULLET), " Please enter a new root password (empty to skip): ");
- msg2 = strappenda(draw_special_char(DRAW_TRIANGULAR_BULLET), " Please enter new root password again: ");
+ msg1 = strjoina(draw_special_char(DRAW_TRIANGULAR_BULLET), " Please enter a new root password (empty to skip): ");
+ msg2 = strjoina(draw_special_char(DRAW_TRIANGULAR_BULLET), " Please enter new root password again: ");
for (;;) {
_cleanup_free_ char *a = NULL, *b = NULL;
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index bc4c1556ca..5662b5fde1 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -404,7 +404,7 @@ static int add_root_mount(void) {
opts = arg_root_rw > 0 ? "rw" : "ro";
else if (arg_root_rw >= 0 ||
!fstab_test_option(arg_root_options, "ro\0" "rw\0"))
- opts = strappenda(arg_root_options, ",", arg_root_rw > 0 ? "rw" : "ro");
+ opts = strjoina(arg_root_options, ",", arg_root_rw > 0 ? "rw" : "ro");
else
opts = arg_root_options;
@@ -461,7 +461,7 @@ static int add_usr_mount(void) {
if (!arg_usr_options)
opts = arg_root_rw > 0 ? "rw" : "ro";
else if (!fstab_test_option(arg_usr_options, "ro\0" "rw\0"))
- opts = strappenda(arg_usr_options, ",", arg_root_rw > 0 ? "rw" : "ro");
+ opts = strjoina(arg_usr_options, ",", arg_root_rw > 0 ? "rw" : "ro");
else
opts = arg_usr_options;
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 931651e161..f8f5fb30c2 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -41,8 +41,8 @@ static int add_symlink(const char *fservice, const char *tservice) {
assert(fservice);
assert(tservice);
- from = strappenda(SYSTEM_DATA_UNIT_PATH "/", fservice);
- to = strappenda(arg_dest, "/getty.target.wants/", tservice);
+ from = strjoina(SYSTEM_DATA_UNIT_PATH "/", fservice);
+ to = strjoina(arg_dest, "/getty.target.wants/", tservice);
mkdir_parents_label(to, 0755);
@@ -97,7 +97,7 @@ static int verify_tty(const char *name) {
* friends. Let's check that and open the device and run
* isatty() on it. */
- p = strappenda("/dev/", name);
+ p = strjoina("/dev/", name);
/* O_NONBLOCK is essential here, to make sure we don't wait
* for DCD */
@@ -218,7 +218,7 @@ int main(int argc, char *argv[]) {
NULSTR_FOREACH(j, virtualization_consoles) {
char *p;
- p = strappenda("/sys/class/tty/", j);
+ p = strjoina("/sys/class/tty/", j);
if (access(p, F_OK) < 0)
continue;
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 909fdda60a..5c58b58f8a 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -147,7 +147,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
if (ferror(f))
return log_error_errno(errno, "Failed to write file %s: %m", p);
- from = strappenda("../", n);
+ from = strjoina("../", n);
to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
if (!to)
diff --git a/src/import/curl-util.c b/src/import/curl-util.c
index 313b04b0b8..d390cfb1f3 100644
--- a/src/import/curl-util.c
+++ b/src/import/curl-util.c
@@ -303,7 +303,7 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) {
goto fail;
}
- useragent = strappenda(program_invocation_short_name, "/" PACKAGE_VERSION);
+ useragent = strjoina(program_invocation_short_name, "/" PACKAGE_VERSION);
if (curl_easy_setopt(c, CURLOPT_USERAGENT, useragent) != CURLE_OK) {
r = -EIO;
goto fail;
diff --git a/src/import/import-common.c b/src/import/import-common.c
index e5531b89c5..2acf380f99 100644
--- a/src/import/import-common.c
+++ b/src/import/import-common.c
@@ -121,7 +121,7 @@ int import_make_local_copy(const char *final, const char *image_root, const char
if (!image_root)
image_root = "/var/lib/machines";
- p = strappenda(image_root, "/", local);
+ p = strjoina(image_root, "/", local);
if (force_local) {
(void) btrfs_subvol_remove(p);
@@ -309,7 +309,7 @@ int import_verify(
return -EBADMSG;
}
- line = strappenda(main_job->checksum, " *", fn, "\n");
+ line = strjoina(main_job->checksum, " *", fn, "\n");
p = memmem(checksum_job->payload,
checksum_job->payload_size,
diff --git a/src/import/import-dkr.c b/src/import/import-dkr.c
index a4ff6f43f0..fb72f6cee3 100644
--- a/src/import/import-dkr.c
+++ b/src/import/import-dkr.c
@@ -399,7 +399,7 @@ static int dkr_import_add_token(DkrImport *i, ImportJob *j) {
assert(j);
if (i->response_token)
- t = strappenda("Authorization: Token ", i->response_token);
+ t = strjoina("Authorization: Token ", i->response_token);
else
t = HEADER_TOKEN " true";
@@ -480,7 +480,7 @@ static int dkr_import_job_on_open_disk(ImportJob *j) {
if (base) {
const char *base_path;
- base_path = strappenda(i->image_root, "/.dkr-", base);
+ base_path = strjoina(i->image_root, "/.dkr-", base);
r = btrfs_subvol_snapshot(base_path, i->temp_path, false, true);
} else
r = btrfs_subvol_make(i->temp_path);
@@ -549,7 +549,7 @@ static int dkr_import_pull_layer(DkrImport *i) {
i->final_path = path;
path = NULL;
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", layer, "/layer");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", layer, "/layer");
r = import_job_new(&i->layer_job, url, i->glue, i);
if (r < 0)
return log_error_errno(r, "Failed to allocate layer job: %m");
@@ -610,7 +610,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
log_info("Index lookup succeeded, directed to registry %s.", i->response_registries[0]);
dkr_import_report_progress(i, DKR_RESOLVING);
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/repositories/", i->name, "/tags/", i->tag);
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/repositories/", i->name, "/tags/", i->tag);
r = import_job_new(&i->tags_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate tags job: %m");
@@ -652,7 +652,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
log_info("Tag lookup succeeded, resolved to layer %s.", i->id);
dkr_import_report_progress(i, DKR_METADATA);
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/ancestry");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/ancestry");
r = import_job_new(&i->ancestry_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate ancestry job: %m");
@@ -668,7 +668,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
i->ancestry_job->on_finished = dkr_import_job_on_finished;
i->ancestry_job->on_progress = dkr_import_job_on_progress;
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/json");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/json");
r = import_job_new(&i->json_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate json job: %m");
@@ -873,7 +873,7 @@ int dkr_import_pull(DkrImport *i, const char *name, const char *tag, const char
if (r < 0)
return r;
- url = strappenda(i->index_url, "/v1/repositories/", name, "/images");
+ url = strjoina(i->index_url, "/v1/repositories/", name, "/images");
r = import_job_new(&i->images_job, url, i->glue, i);
if (r < 0)
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 5c88cdb007..8d99f1085c 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -270,7 +270,7 @@ static int raw_import_make_local_copy(RawImport *i) {
return log_error_errno(errno, "Failed to seek to beginning of vendor image: %m");
}
- p = strappenda(i->image_root, "/", i->local, ".raw");
+ p = strjoina(i->image_root, "/", i->local, ".raw");
if (i->force_local) {
(void) btrfs_subvol_remove(p);
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index f1c409cd94..8f32a9a988 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -885,7 +885,7 @@ static int remoteserver_init(RemoteServer *s,
if (arg_url) {
const char *url, *hostname;
- url = strappenda(arg_url, "/entries");
+ url = strjoina(arg_url, "/entries");
if (arg_getter) {
log_info("Spawning getter %s...", url);
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
index 277e125403..34d93379da 100644
--- a/src/journal-remote/microhttpd-util.c
+++ b/src/journal-remote/microhttpd-util.c
@@ -38,7 +38,7 @@
void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
char *f;
- f = strappenda("microhttpd: ", fmt);
+ f = strjoina("microhttpd: ", fmt);
DISABLE_WARNING_FORMAT_NONLITERAL;
log_internalv(LOG_INFO, 0, NULL, 0, NULL, f, ap);
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index f6b95145d2..f7ba0191e1 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -634,11 +634,11 @@ int main(int argc, char* argv[]) {
goto finish;
}
- core_unit = strappenda("COREDUMP_UNIT=", t);
+ core_unit = strjoina("COREDUMP_UNIT=", t);
free(t);
} else if (cg_pid_get_user_unit(pid, &t) >= 0) {
- core_unit = strappenda("COREDUMP_USER_UNIT=", t);
+ core_unit = strjoina("COREDUMP_USER_UNIT=", t);
free(t);
}
@@ -650,20 +650,20 @@ int main(int argc, char* argv[]) {
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
log_open();
- core_pid = strappenda("COREDUMP_PID=", info[INFO_PID]);
+ core_pid = strjoina("COREDUMP_PID=", info[INFO_PID]);
IOVEC_SET_STRING(iovec[j++], core_pid);
- core_uid = strappenda("COREDUMP_UID=", info[INFO_UID]);
+ core_uid = strjoina("COREDUMP_UID=", info[INFO_UID]);
IOVEC_SET_STRING(iovec[j++], core_uid);
- core_gid = strappenda("COREDUMP_GID=", info[INFO_GID]);
+ core_gid = strjoina("COREDUMP_GID=", info[INFO_GID]);
IOVEC_SET_STRING(iovec[j++], core_gid);
- core_signal = strappenda("COREDUMP_SIGNAL=", info[INFO_SIGNAL]);
+ core_signal = strjoina("COREDUMP_SIGNAL=", info[INFO_SIGNAL]);
IOVEC_SET_STRING(iovec[j++], core_signal);
if (sd_pid_get_session(pid, &t) >= 0) {
- core_session = strappenda("COREDUMP_SESSION=", t);
+ core_session = strjoina("COREDUMP_SESSION=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_session);
@@ -677,31 +677,31 @@ int main(int argc, char* argv[]) {
}
if (sd_pid_get_slice(pid, &t) >= 0) {
- core_slice = strappenda("COREDUMP_SLICE=", t);
+ core_slice = strjoina("COREDUMP_SLICE=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_slice);
}
if (comm) {
- core_comm = strappenda("COREDUMP_COMM=", comm);
+ core_comm = strjoina("COREDUMP_COMM=", comm);
IOVEC_SET_STRING(iovec[j++], core_comm);
}
if (exe) {
- core_exe = strappenda("COREDUMP_EXE=", exe);
+ core_exe = strjoina("COREDUMP_EXE=", exe);
IOVEC_SET_STRING(iovec[j++], core_exe);
}
if (get_process_cmdline(pid, 0, false, &t) >= 0) {
- core_cmdline = strappenda("COREDUMP_CMDLINE=", t);
+ core_cmdline = strjoina("COREDUMP_CMDLINE=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_cmdline);
}
if (cg_pid_get_path_shifted(pid, NULL, &t) >= 0) {
- core_cgroup = strappenda("COREDUMP_CGROUP=", t);
+ core_cgroup = strjoina("COREDUMP_CGROUP=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_cgroup);
@@ -752,14 +752,14 @@ int main(int argc, char* argv[]) {
}
if (get_process_cwd(pid, &t) >= 0) {
- core_cwd = strappenda("COREDUMP_CWD=", t);
+ core_cwd = strjoina("COREDUMP_CWD=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_cwd);
}
if (get_process_root(pid, &t) >= 0) {
- core_root = strappenda("COREDUMP_ROOT=", t);
+ core_root = strjoina("COREDUMP_ROOT=", t);
free(t);
IOVEC_SET_STRING(iovec[j++], core_root);
@@ -799,7 +799,7 @@ int main(int argc, char* argv[]) {
if (r == 0) {
const char *coredump_filename;
- coredump_filename = strappenda("COREDUMP_FILENAME=", filename);
+ coredump_filename = strjoina("COREDUMP_FILENAME=", filename);
IOVEC_SET_STRING(iovec[j++], coredump_filename);
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index c17cf55c30..55c7786331 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1269,7 +1269,7 @@ static int add_syslog_identifier(sd_journal *j) {
STRV_FOREACH(i, arg_syslog_identifier) {
char *u;
- u = strappenda("SYSLOG_IDENTIFIER=", *i);
+ u = strjoina("SYSLOG_IDENTIFIER=", *i);
r = sd_journal_add_match(j, u, 0);
if (r < 0)
return r;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index aecf8596dc..7ee8174ea2 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -378,7 +378,7 @@ static void do_vacuum(
if (!f)
return;
- p = strappenda(path, id);
+ p = strjoina(path, id);
r = journal_directory_vacuum(p, metrics->max_use, s->max_retention_usec, &s->oldest_file_usec, false);
if (r < 0 && r != -ENOENT)
log_error_errno(r, "Failed to vacuum %s: %m", p);
@@ -589,28 +589,28 @@ static void dispatch_message_real(
r = get_process_comm(ucred->pid, &t);
if (r >= 0) {
- x = strappenda("_COMM=", t);
+ x = strjoina("_COMM=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
r = get_process_exe(ucred->pid, &t);
if (r >= 0) {
- x = strappenda("_EXE=", t);
+ x = strjoina("_EXE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
r = get_process_cmdline(ucred->pid, 0, false, &t);
if (r >= 0) {
- x = strappenda("_CMDLINE=", t);
+ x = strjoina("_CMDLINE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
r = get_process_capeff(ucred->pid, &t);
if (r >= 0) {
- x = strappenda("_CAP_EFFECTIVE=", t);
+ x = strjoina("_CAP_EFFECTIVE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
@@ -633,12 +633,12 @@ static void dispatch_message_real(
if (r >= 0) {
char *session = NULL;
- x = strappenda("_SYSTEMD_CGROUP=", c);
+ x = strjoina("_SYSTEMD_CGROUP=", c);
IOVEC_SET_STRING(iovec[n++], x);
r = cg_path_get_session(c, &t);
if (r >= 0) {
- session = strappenda("_SYSTEMD_SESSION=", t);
+ session = strjoina("_SYSTEMD_SESSION=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], session);
}
@@ -651,32 +651,32 @@ static void dispatch_message_real(
}
if (cg_path_get_unit(c, &t) >= 0) {
- x = strappenda("_SYSTEMD_UNIT=", t);
+ x = strjoina("_SYSTEMD_UNIT=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
} else if (unit_id && !session) {
- x = strappenda("_SYSTEMD_UNIT=", unit_id);
+ x = strjoina("_SYSTEMD_UNIT=", unit_id);
IOVEC_SET_STRING(iovec[n++], x);
}
if (cg_path_get_user_unit(c, &t) >= 0) {
- x = strappenda("_SYSTEMD_USER_UNIT=", t);
+ x = strjoina("_SYSTEMD_USER_UNIT=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
} else if (unit_id && session) {
- x = strappenda("_SYSTEMD_USER_UNIT=", unit_id);
+ x = strjoina("_SYSTEMD_USER_UNIT=", unit_id);
IOVEC_SET_STRING(iovec[n++], x);
}
if (cg_path_get_slice(c, &t) >= 0) {
- x = strappenda("_SYSTEMD_SLICE=", t);
+ x = strjoina("_SYSTEMD_SLICE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
free(c);
} else if (unit_id) {
- x = strappenda("_SYSTEMD_UNIT=", unit_id);
+ x = strjoina("_SYSTEMD_UNIT=", unit_id);
IOVEC_SET_STRING(iovec[n++], x);
}
@@ -691,7 +691,7 @@ static void dispatch_message_real(
security_context_t con;
if (getpidcon(ucred->pid, &con) >= 0) {
- x = strappenda("_SELINUX_CONTEXT=", con);
+ x = strjoina("_SELINUX_CONTEXT=", con);
freecon(con);
IOVEC_SET_STRING(iovec[n++], x);
@@ -717,21 +717,21 @@ static void dispatch_message_real(
r = get_process_comm(object_pid, &t);
if (r >= 0) {
- x = strappenda("OBJECT_COMM=", t);
+ x = strjoina("OBJECT_COMM=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
r = get_process_exe(object_pid, &t);
if (r >= 0) {
- x = strappenda("OBJECT_EXE=", t);
+ x = strjoina("OBJECT_EXE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
r = get_process_cmdline(object_pid, 0, false, &t);
if (r >= 0) {
- x = strappenda("OBJECT_CMDLINE=", t);
+ x = strjoina("OBJECT_CMDLINE=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
@@ -752,12 +752,12 @@ static void dispatch_message_real(
r = cg_pid_get_path_shifted(object_pid, s->cgroup_root, &c);
if (r >= 0) {
- x = strappenda("OBJECT_SYSTEMD_CGROUP=", c);
+ x = strjoina("OBJECT_SYSTEMD_CGROUP=", c);
IOVEC_SET_STRING(iovec[n++], x);
r = cg_path_get_session(c, &t);
if (r >= 0) {
- x = strappenda("OBJECT_SYSTEMD_SESSION=", t);
+ x = strjoina("OBJECT_SYSTEMD_SESSION=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
@@ -768,13 +768,13 @@ static void dispatch_message_real(
}
if (cg_path_get_unit(c, &t) >= 0) {
- x = strappenda("OBJECT_SYSTEMD_UNIT=", t);
+ x = strjoina("OBJECT_SYSTEMD_UNIT=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
if (cg_path_get_user_unit(c, &t) >= 0) {
- x = strappenda("OBJECT_SYSTEMD_USER_UNIT=", t);
+ x = strjoina("OBJECT_SYSTEMD_USER_UNIT=", t);
free(t);
IOVEC_SET_STRING(iovec[n++], x);
}
@@ -944,10 +944,10 @@ static int system_journal_open(Server *s, bool flush_requested) {
if (s->storage == STORAGE_PERSISTENT)
(void) mkdir("/var/log/journal/", 0755);
- fn = strappenda("/var/log/journal/", ids);
+ fn = strjoina("/var/log/journal/", ids);
(void) mkdir(fn, 0755);
- fn = strappenda(fn, "/system.journal");
+ fn = strjoina(fn, "/system.journal");
r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal);
if (r >= 0)
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index ba6e3316d6..355f6e6a4b 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -356,18 +356,18 @@ void server_process_syslog_message(
}
if (identifier) {
- syslog_identifier = strappenda("SYSLOG_IDENTIFIER=", identifier);
+ syslog_identifier = strjoina("SYSLOG_IDENTIFIER=", identifier);
if (syslog_identifier)
IOVEC_SET_STRING(iovec[n++], syslog_identifier);
}
if (pid) {
- syslog_pid = strappenda("SYSLOG_PID=", pid);
+ syslog_pid = strjoina("SYSLOG_PID=", pid);
if (syslog_pid)
IOVEC_SET_STRING(iovec[n++], syslog_pid);
}
- message = strappenda("MESSAGE=", buf);
+ message = strjoina("MESSAGE=", buf);
if (message)
IOVEC_SET_STRING(iovec[n++], message);
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 9dea5470be..ecf47fda3d 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1155,9 +1155,9 @@ static void check_network(sd_journal *j, int fd) {
static bool file_has_type_prefix(const char *prefix, const char *filename) {
const char *full, *tilded, *atted;
- full = strappenda(prefix, ".journal");
- tilded = strappenda(full, "~");
- atted = strappenda(prefix, "@");
+ full = strjoina(prefix, ".journal");
+ tilded = strjoina(full, "~");
+ atted = strjoina(prefix, "@");
return streq(filename, full) ||
streq(filename, tilded) ||
@@ -1399,7 +1399,7 @@ static int add_root_directory(sd_journal *j, const char *p) {
return -EINVAL;
if (j->prefix)
- p = strappenda(j->prefix, p);
+ p = strjoina(j->prefix, p);
d = opendir(p);
if (!d)
@@ -1643,7 +1643,7 @@ _public_ int sd_journal_open_container(sd_journal **ret, const char *machine, in
assert_return((flags & ~(SD_JOURNAL_LOCAL_ONLY|SD_JOURNAL_SYSTEM)) == 0, -EINVAL);
assert_return(machine_name_is_valid(machine), -EINVAL);
- p = strappenda("/run/systemd/machines/", machine);
+ p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL);
if (r == -ENOENT)
return -EHOSTDOWN;
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index def8ea5ebe..6ee3d8150c 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -631,7 +631,7 @@ idev_device *idev_find_keyboard(idev_session *s, const char *name) {
assert_return(s, NULL);
assert_return(name, NULL);
- kname = strappenda("keyboard/", name);
+ kname = strjoina("keyboard/", name);
return hashmap_get(s->device_map, kname);
}
@@ -793,7 +793,7 @@ int idev_keyboard_new(idev_device **out, idev_session *s, const char *name) {
if (r < 0)
return r;
- kname = strappenda("keyboard/", name);
+ kname = strjoina("keyboard/", name);
r = idev_device_add(d, kname);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 8d12c258f7..ac27df8691 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -1359,7 +1359,7 @@ int bus_add_match_internal_kernel(
#define internal_match(bus, m) \
((bus)->hello_flags & KDBUS_HELLO_MONITOR \
- ? (isempty(m) ? "eavesdrop='true'" : strappenda((m), ",eavesdrop='true'")) \
+ ? (isempty(m) ? "eavesdrop='true'" : strjoina((m), ",eavesdrop='true'")) \
: (m))
static int bus_add_match_internal_dbus1(
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index e27d8027de..7181639645 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -354,7 +354,7 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) {
color = ansi_highlight();
off = ansi_highlight_off();
- suffix = strappenda(off, "\n");
+ suffix = strjoina(off, "\n");
}
if (c->mask & SD_BUS_CREDS_PID)
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index f0bc2a76a5..d3c1772019 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -256,8 +256,8 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
l++;
}
- vertical = strappenda(prefix, draw_special_char(DRAW_TREE_VERTICAL));
- space = strappenda(prefix, draw_special_char(DRAW_TREE_SPACE));
+ vertical = strjoina(prefix, draw_special_char(DRAW_TREE_VERTICAL));
+ space = strjoina(prefix, draw_special_char(DRAW_TREE_SPACE));
for (;;) {
bool has_more = false;
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 125b302c95..1bf77e46fb 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1286,7 +1286,7 @@ int bus_set_address_system_remote(sd_bus *b, const char *host) {
if (!e)
return -ENOMEM;
- c = strappenda(",argv4=--machine=", m);
+ c = strjoina(",argv4=--machine=", m);
}
}
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index c72d23ed53..c171405a65 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -791,7 +791,7 @@ _public_ int sd_machine_get_class(const char *machine, char **class) {
assert_return(machine_name_is_valid(machine), -EINVAL);
assert_return(class, -EINVAL);
- p = strappenda("/run/systemd/machines/", machine);
+ p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "CLASS", &c, NULL);
if (r < 0)
return r;
@@ -814,7 +814,7 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ifindices) {
assert_return(machine_name_is_valid(machine), -EINVAL);
assert_return(ifindices, -EINVAL);
- p = strappenda("/run/systemd/machines/", machine);
+ p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "NETIF", &netif, NULL);
if (r < 0)
return r;
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index d5206aa804..9863901a33 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -1936,7 +1936,7 @@ int udev_device_rename(struct udev_device *udev_device, const char *name)
if (!dirname)
return -ENOMEM;
- new_syspath = strappenda(dirname, "/", name);
+ new_syspath = strjoina(dirname, "/", name);
r = udev_device_set_syspath(udev_device, new_syspath);
if (r < 0)
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 529a9abfd6..ed763c36f6 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -1011,7 +1011,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata
static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) {
const char *fmt;
- fmt = strappenda("libxkbcommon: ", format);
+ fmt = strjoina("libxkbcommon: ", format);
log_internalv(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, fmt, args);
}
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index e22b106b3c..d7211e66ce 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -247,7 +247,7 @@ int button_open(Button *b) {
b->fd = -1;
}
- p = strappenda("/dev/input/", b->name);
+ p = strjoina("/dev/input/", b->name);
b->fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
if (b->fd < 0)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index c7c1559d50..8b0bafd49e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1136,7 +1136,7 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
if (!cc)
return -ENOMEM;
- path = strappenda("/var/lib/systemd/linger/", cc);
+ path = strjoina("/var/lib/systemd/linger/", cc);
if (b) {
User *u;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 928afd35e2..7b40ef5952 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -659,7 +659,7 @@ int user_check_linger_file(User *u) {
if (!cc)
return -ENOMEM;
- p = strappenda("/var/lib/systemd/linger/", cc);
+ p = strjoina("/var/lib/systemd/linger/", cc);
return access(p, F_OK) >= 0;
}
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 6c01617cfb..223eb0f364 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -211,7 +211,7 @@ int machine_save(Machine *m) {
/* Create a symlink from the unit name to the machine
* name, so that we can quickly find the machine for
* each given unit */
- sl = strappenda("/run/systemd/machines/unit:", m->unit);
+ sl = strjoina("/run/systemd/machines/unit:", m->unit);
symlink(m->name, sl);
}
@@ -232,7 +232,7 @@ static void machine_unlink(Machine *m) {
char *sl;
- sl = strappenda("/run/systemd/machines/unit:", m->unit);
+ sl = strjoina("/run/systemd/machines/unit:", m->unit);
unlink(sl);
}
@@ -340,7 +340,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er
if (!scope)
return log_oom();
- description = strappenda(m->class == MACHINE_VM ? "Virtual Machine " : "Container ", m->name);
+ description = strjoina(m->class == MACHINE_VM ? "Virtual Machine " : "Container ", m->name);
r = manager_start_scope(m->manager, scope, m->leader, SPECIAL_MACHINE_SLICE, description, properties, error, &job);
if (r < 0) {
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 06ae8bc0a8..16ce2f424b 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1160,7 +1160,7 @@ static int bind_mount(int argc, char *argv[], void *userdata) {
return -EINVAL;
}
- p = strappenda("/run/systemd/nspawn/propagate/", argv[1], "/");
+ p = strjoina("/run/systemd/nspawn/propagate/", argv[1], "/");
if (access(p, F_OK) < 0) {
log_error("Container does not allow propagation of mount points.");
return -ENOTSUP;
@@ -1198,7 +1198,7 @@ static int bind_mount(int argc, char *argv[], void *userdata) {
/* Second, we mount the source directory to a directory inside
of our MS_SLAVE playground. */
- mount_tmp = strappenda(mount_slave, "/mount");
+ mount_tmp = strjoina(mount_slave, "/mount");
if (mkdir(mount_tmp, 0700) < 0) {
r = log_error_errno(errno, "Failed to create temporary mount: %m");
goto finish;
@@ -1224,7 +1224,7 @@ static int bind_mount(int argc, char *argv[], void *userdata) {
* directory. This way it will appear there read-only
* right-away. */
- mount_outside = strappenda("/run/systemd/nspawn/propagate/", argv[1], "/XXXXXX");
+ mount_outside = strjoina("/run/systemd/nspawn/propagate/", argv[1], "/XXXXXX");
if (!mkdtemp(mount_outside)) {
r = log_error_errno(errno, "Cannot create propagation directory: %m");
goto finish;
@@ -1276,7 +1276,7 @@ static int bind_mount(int argc, char *argv[], void *userdata) {
mkdir_p(dest, 0755);
/* Fifth, move the mount to the right place inside */
- mount_inside = strappenda("/run/systemd/nspawn/incoming/", basename(mount_outside));
+ mount_inside = strjoina("/run/systemd/nspawn/incoming/", basename(mount_outside));
if (mount(mount_inside, dest, NULL, MS_MOVE, NULL) < 0) {
log_error_errno(errno, "Failed to mount: %m");
_exit(EXIT_FAILURE);
@@ -1376,7 +1376,7 @@ static int login_machine(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to attach bus to event loop: %m");
- match = strappenda("type='signal',"
+ match = strjoina("type='signal',"
"sender='org.freedesktop.machine1',"
"path='/org/freedesktop/machine1',",
"interface='org.freedesktop.machine1.Manager',"
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index acdb486381..a8d9bc0a13 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1243,7 +1243,7 @@ static int link_set_ipv4_forward(Link *link) {
b = link_ipv4_forward_enabled(link);
- p = strappenda("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
+ p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(b));
if (r < 0)
log_link_warning_errno(link, r, "Cannot configure IPv4 forwarding for interface %s: %m", link->ifname);
@@ -1278,7 +1278,7 @@ static int link_set_ipv6_forward(Link *link) {
const char *p = NULL;
int r;
- p = strappenda("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
+ p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv6_forward_enabled(link)));
if (r < 0)
log_link_warning_errno(link, r, "Cannot configure IPv6 forwarding for interface: %m");
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 226c4415bb..1e6e7bf302 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -962,7 +962,7 @@ static int mount_cgroup_hierarchy(const char *dest, const char *controller, cons
char *to;
int r;
- to = strappenda(dest, "/sys/fs/cgroup/", hierarchy);
+ to = strjoina(dest, "/sys/fs/cgroup/", hierarchy);
r = path_is_mount_point(to, false);
if (r < 0)
@@ -1004,7 +1004,7 @@ static int mount_cgroup(const char *dest) {
if (r < 0)
return log_error_errno(r, "Failed to determine our own cgroup path: %m");
- cgroup_root = strappenda(dest, "/sys/fs/cgroup");
+ cgroup_root = strjoina(dest, "/sys/fs/cgroup");
if (mount("tmpfs", cgroup_root, "tmpfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME, "mode=755") < 0)
return log_error_errno(errno, "Failed to mount tmpfs to /sys/fs/cgroup: %m");
@@ -1057,12 +1057,12 @@ static int mount_cgroup(const char *dest) {
return r;
/* Make our own cgroup a (writable) bind mount */
- systemd_own = strappenda(dest, "/sys/fs/cgroup/systemd", own_cgroup_path);
+ systemd_own = strjoina(dest, "/sys/fs/cgroup/systemd", own_cgroup_path);
if (mount(systemd_own, systemd_own, NULL, MS_BIND, NULL) < 0)
return log_error_errno(errno, "Failed to turn %s into a bind mount: %m", own_cgroup_path);
/* And then remount the systemd cgroup root read-only */
- systemd_root = strappenda(dest, "/sys/fs/cgroup/systemd");
+ systemd_root = strjoina(dest, "/sys/fs/cgroup/systemd");
if (mount(NULL, systemd_root, NULL, MS_BIND|MS_REMOUNT|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, NULL) < 0)
return log_error_errno(errno, "Failed to mount cgroup root read-only: %m");
@@ -1215,7 +1215,7 @@ static int setup_volatile_state(const char *directory) {
if (r < 0)
return log_error_errno(r, "Failed to remount %s read-only: %m", directory);
- p = strappenda(directory, "/var");
+ p = strjoina(directory, "/var");
r = mkdir(p, 0755);
if (r < 0 && errno != EEXIST)
return log_error_errno(errno, "Failed to create %s: %m", directory);
@@ -1251,8 +1251,8 @@ static int setup_volatile(const char *directory) {
tmpfs_mounted = true;
- f = strappenda(directory, "/usr");
- t = strappenda(template, "/usr");
+ f = strjoina(directory, "/usr");
+ t = strjoina(template, "/usr");
r = mkdir(t, 0755);
if (r < 0 && errno != EEXIST) {
@@ -1434,7 +1434,7 @@ static int setup_dev_console(const char *dest, const char *console) {
* /dev/console. (Note that the major minor doesn't actually
* matter here, since we mount it over anyway). */
- to = strappenda(dest, "/dev/console");
+ to = strjoina(dest, "/dev/console");
if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0)
return log_error_errno(errno, "mknod() for /dev/console failed: %m");
@@ -2564,10 +2564,10 @@ static int setup_propagate(const char *root) {
(void) mkdir_p("/run/systemd/nspawn/", 0755);
(void) mkdir_p("/run/systemd/nspawn/propagate", 0600);
- p = strappenda("/run/systemd/nspawn/propagate/", arg_machine);
+ p = strjoina("/run/systemd/nspawn/propagate/", arg_machine);
(void) mkdir_p(p, 0600);
- q = strappenda(root, "/run/systemd/nspawn/incoming");
+ q = strjoina(root, "/run/systemd/nspawn/incoming");
mkdir_parents(q, 0755);
mkdir_p(q, 0600);
@@ -3050,7 +3050,7 @@ static int mount_device(const char *what, const char *where, const char *directo
rw = false;
if (directory)
- p = strappenda(where, directory);
+ p = strjoina(where, directory);
else
p = where;
@@ -3685,7 +3685,7 @@ int main(int argc, char *argv[]) {
} else {
const char *p;
- p = strappenda(arg_directory,
+ p = strjoina(arg_directory,
argc > optind && path_is_absolute(argv[optind]) ? argv[optind] : "/usr/bin/");
if (access(p, F_OK) < 0) {
log_error("Directory %s lacks the binary to execute or doesn't look like a binary tree. Refusing.", arg_directory);
@@ -4294,7 +4294,7 @@ finish:
if (arg_machine) {
const char *p;
- p = strappenda("/run/systemd/nspawn/propagate/", arg_machine);
+ p = strjoina("/run/systemd/nspawn/propagate/", arg_machine);
(void) rm_rf(p, false, true, false);
}
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 8161b5321f..03c84786db 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -76,7 +76,7 @@ static int reply_query_state(DnsQuery *q) {
rc = p;
}
- n = strappenda(_BUS_ERROR_DNS, rc);
+ n = strjoina(_BUS_ERROR_DNS, rc);
sd_bus_error_setf(&error, n, "Could not resolve '%s', server or network returned error %s", name, rc);
}
diff --git a/src/run/run.c b/src/run/run.c
index 723e0cb31a..0661b3bee9 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -494,7 +494,7 @@ static int transient_service_set_properties(sd_bus_message *m, char **argv, cons
if (e) {
char *n;
- n = strappenda("TERM=", e);
+ n = strjoina("TERM=", e);
r = sd_bus_message_append(m,
"(sv)",
"Environment", "as", 1, n);
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index ea66c76724..cbd94e86d9 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -93,7 +93,7 @@ static int show_cgroup_one_by_path(const char *path, const char *prefix, unsigne
if (r < 0)
return r;
- fn = strappenda(p, "/cgroup.procs");
+ fn = strjoina(p, "/cgroup.procs");
f = fopen(fn, "re");
if (!f)
return -errno;
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 0d3cc53517..b527868e6b 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -510,7 +510,7 @@ static int check_hierarchy(const char *p) {
return 0;
/* Check if this controller actually really exists */
- cc = strappenda("/sys/fs/cgroup/", p);
+ cc = strjoina("/sys/fs/cgroup/", p);
if (laccess(cc, F_OK) < 0)
return -errno;
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 4faca2b8dc..da7560f05f 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -288,7 +288,7 @@ static int condition_test_needs_update(Condition *c) {
if (!path_is_absolute(c->parameter))
return true;
- p = strappenda(c->parameter, "/.updated");
+ p = strjoina(c->parameter, "/.updated");
if (lstat(p, &other) < 0)
return true;
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 51f4e0105c..db4937db88 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -44,7 +44,7 @@ static int files_add(Hashmap *h, const char *root, const char *path, const char
assert(path);
assert(suffix);
- dirpath = strappenda(root ? root : "", path);
+ dirpath = strjoina(root ? root : "", path);
dir = opendir(dirpath);
if (!dir) {
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 4140afba82..7f16d5cbef 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -62,7 +62,7 @@ int generator_write_fsck_deps(
if (streq(where, "/")) {
char *lnk;
- lnk = strappenda(dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
+ lnk = strjoina(dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
mkdir_parents(lnk, 0755);
if (symlink(SYSTEM_DATA_UNIT_PATH "/systemd-fsck-root.service", lnk) < 0)
diff --git a/src/shared/install.c b/src/shared/install.c
index 37191a7c71..65f1c245c6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1048,7 +1048,7 @@ static int unit_file_load(
assert(path);
if (!isempty(root_dir))
- path = strappenda(root_dir, "/", path);
+ path = strjoina(root_dir, "/", path);
if (!load) {
r = access(path, F_OK) ? -errno : 0;
@@ -1730,7 +1730,7 @@ int unit_file_set_default(
if (r < 0)
return r;
- path = strappenda(config_path, "/" SPECIAL_DEFAULT_TARGET);
+ path = strjoina(config_path, "/" SPECIAL_DEFAULT_TARGET);
r = create_symlink(i->path, path, force, changes, n_changes);
if (r < 0)
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index b7a99d2c23..45741f9e9d 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -1033,10 +1033,10 @@ int add_matches_for_unit(sd_journal *j, const char *unit) {
assert(j);
assert(unit);
- m1 = strappenda("_SYSTEMD_UNIT=", unit);
- m2 = strappenda("COREDUMP_UNIT=", unit);
- m3 = strappenda("UNIT=", unit);
- m4 = strappenda("OBJECT_SYSTEMD_UNIT=", unit);
+ m1 = strjoina("_SYSTEMD_UNIT=", unit);
+ m2 = strjoina("COREDUMP_UNIT=", unit);
+ m3 = strjoina("UNIT=", unit);
+ m4 = strjoina("OBJECT_SYSTEMD_UNIT=", unit);
(void)(
/* Look for messages from the service itself */
@@ -1080,10 +1080,10 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) {
assert(j);
assert(unit);
- m1 = strappenda("_SYSTEMD_USER_UNIT=", unit);
- m2 = strappenda("USER_UNIT=", unit);
- m3 = strappenda("COREDUMP_USER_UNIT=", unit);
- m4 = strappenda("OBJECT_SYSTEMD_USER_UNIT=", unit);
+ m1 = strjoina("_SYSTEMD_USER_UNIT=", unit);
+ m2 = strjoina("USER_UNIT=", unit);
+ m3 = strjoina("COREDUMP_USER_UNIT=", unit);
+ m4 = strjoina("OBJECT_SYSTEMD_USER_UNIT=", unit);
sprintf(muid, "_UID="UID_FMT, uid);
(void) (
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 8ea61052bd..8d61507e84 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -425,7 +425,7 @@ int image_rename(Image *i, const char *new_name) {
case IMAGE_RAW: {
const char *fn;
- fn = strappenda(new_name, ".raw");
+ fn = strjoina(new_name, ".raw");
new_path = file_in_same_dir(i->path, fn);
break;
}
@@ -486,13 +486,13 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
case IMAGE_SUBVOLUME:
case IMAGE_DIRECTORY:
- new_path = strappenda("/var/lib/machines/", new_name);
+ new_path = strjoina("/var/lib/machines/", new_name);
r = btrfs_subvol_snapshot(i->path, new_path, read_only, true);
break;
case IMAGE_RAW:
- new_path = strappenda("/var/lib/machines/", new_name, ".raw");
+ new_path = strjoina("/var/lib/machines/", new_name, ".raw");
r = copy_file_atomic(i->path, new_path, read_only ? 0444 : 0644, false, FS_NOCOW_FL);
break;
@@ -629,7 +629,7 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
return -EBUSY;
mkdir_p("/run/systemd/nspawn/locks", 0600);
- p = strappenda("/run/systemd/nspawn/locks/name-", name);
+ p = strjoina("/run/systemd/nspawn/locks/name-", name);
return make_lock_file(p, operation, ret);
}
diff --git a/src/shared/pager.c b/src/shared/pager.c
index a9f2b7e4f4..8635d9a600 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -91,7 +91,7 @@ int pager_open(bool jump_to_end) {
if (!less_opts)
less_opts = "FRSXMK";
if (jump_to_end)
- less_opts = strappenda(less_opts, " +G");
+ less_opts = strjoina(less_opts, " +G");
setenv("LESS", less_opts, 1);
/* Make sure the pager goes away when the parent dies */
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 00d2d44993..b9db7f1047 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -560,14 +560,14 @@ int path_is_os_tree(const char *path) {
int r;
/* We use /usr/lib/os-release as flag file if something is an OS */
- p = strappenda(path, "/usr/lib/os-release");
+ p = strjoina(path, "/usr/lib/os-release");
r = access(p, F_OK);
if (r >= 0)
return 1;
/* Also check for the old location in /etc, just in case. */
- p = strappenda(path, "/etc/os-release");
+ p = strjoina(path, "/etc/os-release");
r = access(p, F_OK);
return r >= 0;
@@ -665,7 +665,7 @@ int fsck_exists(const char *fstype) {
const char *checker;
int r;
- checker = strappenda("fsck.", fstype);
+ checker = strjoina("fsck.", fstype);
r = find_binary(checker, true, &p);
if (r < 0)
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index e8cedc69cc..813641ad44 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -51,7 +51,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot,
if (path_equal(new_root, "/"))
return 0;
- temporary_old_root = strappenda(new_root, oldroot);
+ temporary_old_root = strjoina(new_root, oldroot);
mkdir_p_label(temporary_old_root, 0755);
old_root_remove = in_initrd();
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index d3404afd55..947ac1fcfb 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -965,7 +965,7 @@ bool timezone_is_valid(const char *name) {
if (slash)
return false;
- t = strappenda("/usr/share/zoneinfo/", name);
+ t = strjoina("/usr/share/zoneinfo/", name);
if (stat(t, &st) < 0)
return false;
diff --git a/src/shared/util.c b/src/shared/util.c
index 11cab6dcf1..c53f9cdb6a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -6452,7 +6452,7 @@ int container_get_leader(const char *machine, pid_t *pid) {
assert(machine);
assert(pid);
- p = strappenda("/run/systemd/machines/", machine);
+ p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL);
if (r == -ENOENT)
return -EHOSTDOWN;
@@ -6691,7 +6691,7 @@ int open_tmpfile(const char *path, int flags) {
#endif
/* Fall back to unguessable name + unlinking */
- p = strappenda(path, "/systemd-tmp-XXXXXX");
+ p = strjoina(path, "/systemd-tmp-XXXXXX");
fd = mkostemp_safe(p, flags);
if (fd < 0)
@@ -7220,7 +7220,7 @@ int take_password_lock(const char *root) {
* awfully racy, and thus we just won't do them. */
if (root)
- path = strappenda(root, "/etc/.pwd.lock");
+ path = strjoina(root, "/etc/.pwd.lock");
else
path = "/etc/.pwd.lock";
diff --git a/src/shared/util.h b/src/shared/util.h
index 410ce65f14..7dfabbc07d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -931,19 +931,19 @@ int unlink_noerrno(const char *path);
(void*)memset(_new_, 0, _size_); \
})
-#define strappenda(a, ...) \
- ({ \
- int _len = strlen(a); \
- unsigned _i; \
- char *_d_, *_p_; \
- const char *_appendees_[] = { __VA_ARGS__ }; \
- for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
- _len += strlen(_appendees_[_i]); \
- _d_ = alloca(_len + 1); \
- _p_ = stpcpy(_d_, a); \
- for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
- _p_ = stpcpy(_p_, _appendees_[_i]); \
- _d_; \
+#define strjoina(a, ...) \
+ ({ \
+ const char *_appendees_[] = { a, __VA_ARGS__ }; \
+ char *_d_, *_p_; \
+ int _len_ = 0; \
+ unsigned _i_; \
+ for (_i_ = 0; _i_ < ELEMENTSOF(_appendees_) && _appendees_[_i_]; _i_++) \
+ _len_ += strlen(_appendees_[_i_]); \
+ _p_ = _d_ = alloca(_len_ + 1); \
+ for (_i_ = 0; _i_ < ELEMENTSOF(_appendees_) && _appendees_[_i_]; _i_++) \
+ _p_ = stpcpy(_p_, _appendees_[_i_]); \
+ *_p_ = 0; \
+ _d_; \
})
#define procfs_file_alloca(pid, field) \
diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c
index 455a84109b..ad34ef1366 100644
--- a/src/system-update-generator/system-update-generator.c
+++ b/src/system-update-generator/system-update-generator.c
@@ -45,7 +45,7 @@ static int generate_symlink(void) {
return -EINVAL;
}
- p = strappenda(arg_dest, "/default.target");
+ p = strjoina(arg_dest, "/default.target");
if (symlink(SYSTEM_DATA_UNIT_PATH "/system-update.target", p) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", p);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 11b0be001f..462f7fdc33 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4978,8 +4978,8 @@ static int switch_root(sd_bus *bus, char **args) {
if (init) {
const char *root_systemd_path = NULL, *root_init_path = NULL;
- root_systemd_path = strappenda(root, "/" SYSTEMD_BINARY_PATH);
- root_init_path = strappenda(root, "/", init);
+ root_systemd_path = strjoina(root, "/" SYSTEMD_BINARY_PATH);
+ root_init_path = strjoina(root, "/", init);
/* If the passed init is actually the same as the
* systemd binary, then let's suppress it. */
@@ -5783,7 +5783,7 @@ static int unit_file_create_dropin(const char *unit_name, const char *user_home,
assert(ret_new_path);
assert(ret_tmp_path);
- ending = strappenda(unit_name, ".d/override.conf");
+ ending = strjoina(unit_name, ".d/override.conf");
r = get_file_to_edit(ending, user_home, user_runtime, &tmp_new_path);
if (r < 0)
return r;
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index f25ece0674..e47bcb4dca 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -81,7 +81,7 @@ static uid_t search_uid = UID_INVALID;
static UidRange *uid_range = NULL;
static unsigned n_uid_range = 0;
-#define fix_root(x) (arg_root ? strappenda(arg_root, x) : x)
+#define fix_root(x) (arg_root ? strjoina(arg_root, x) : x)
static int load_user_database(void) {
_cleanup_fclose_ FILE *f = NULL;
@@ -217,7 +217,7 @@ static int make_backup(const char *target, const char *x) {
/* Don't fail on chmod() or chown(). If it stays owned by us
* and/or unreadable by others, then it isn't too bad... */
- backup = strappenda(x, "-");
+ backup = strjoina(x, "-");
/* Copy over the access mask */
if (fchmod(fileno(dst), st.st_mode & 07777) < 0)
diff --git a/src/test/test-conf-files.c b/src/test/test-conf-files.c
index 71cfc022dd..894c7f742f 100644
--- a/src/test/test-conf-files.c
+++ b/src/test/test-conf-files.c
@@ -59,12 +59,12 @@ static void test_conf_files_list(bool use_root) {
search_2 = "/dir2";
} else {
root_dir = NULL;
- search_1 = strappenda(tmp_dir, "/dir1");
- search_2 = strappenda(tmp_dir, "/dir2");
+ search_1 = strjoina(tmp_dir, "/dir1");
+ search_2 = strjoina(tmp_dir, "/dir2");
}
- expect_a = strappenda(tmp_dir, "/dir1/a.conf");
- expect_b = strappenda(tmp_dir, "/dir2/b.conf");
+ expect_a = strjoina(tmp_dir, "/dir1/a.conf");
+ expect_b = strjoina(tmp_dir, "/dir2/b.conf");
assert_se(conf_files_list(&found_files, ".conf", root_dir, search_1, search_2, NULL) == 0);
strv_print(found_files);
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index 3e1607e51d..5c96f61005 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -90,15 +90,15 @@ static void test_copy_tree(void) {
rm_rf_dangerous(original_dir, false, true, false);
STRV_FOREACH(p, files) {
- char *f = strappenda(original_dir, *p);
+ char *f = strjoina(original_dir, *p);
assert_se(mkdir_parents(f, 0755) >= 0);
assert_se(write_string_file(f, "file") == 0);
}
STRV_FOREACH_PAIR(link, p, links) {
- char *f = strappenda(original_dir, *p);
- char *l = strappenda(original_dir, *link);
+ char *f = strjoina(original_dir, *p);
+ char *l = strjoina(original_dir, *link);
assert_se(mkdir_parents(l, 0755) >= 0);
assert_se(symlink(f, l) == 0);
@@ -109,7 +109,7 @@ static void test_copy_tree(void) {
STRV_FOREACH(p, files) {
_cleanup_free_ char *buf = NULL;
size_t sz = 0;
- char *f = strappenda(copy_dir, *p);
+ char *f = strjoina(copy_dir, *p);
assert_se(access(f, F_OK) == 0);
assert_se(read_full_file(f, &buf, &sz) == 0);
@@ -118,8 +118,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *target = NULL;
- char *f = strappenda(original_dir, *p);
- char *l = strappenda(copy_dir, *link);
+ char *f = strjoina(original_dir, *p);
+ char *l = strjoina(copy_dir, *link);
assert_se(readlink_and_canonicalize(l, &target) == 0);
assert_se(path_equal(f, target));
diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c
index 084a58f3aa..2397db5fff 100644
--- a/src/test/test-namespace.c
+++ b/src/test/test-namespace.c
@@ -42,8 +42,8 @@ static void test_tmpdir(const char *id, const char *A, const char *B) {
assert_se((x.st_mode & 01777) == 0700);
assert_se((y.st_mode & 01777) == 0700);
- c = strappenda(a, "/tmp");
- d = strappenda(b, "/tmp");
+ c = strjoina(a, "/tmp");
+ d = strjoina(b, "/tmp");
assert_se(stat(c, &x) >= 0);
assert_se(stat(d, &y) >= 0);
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index a6ce8c9d8d..38e5c93df6 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -33,9 +33,9 @@ static void test_paths(SystemdRunningAs running_as, bool personal) {
char *exists, *not;
assert_se(mkdtemp(template));
- exists = strappenda(template, "/exists");
+ exists = strjoina(template, "/exists");
assert_se(mkdir(exists, 0755) == 0);
- not = strappenda(template, "/not");
+ not = strjoina(template, "/not");
assert_se(lookup_paths_init(&lp, running_as, personal, NULL, exists, not, not) == 0);
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 1512ae2b19..4f9f5c1344 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -47,7 +47,7 @@ static int setup_test(Manager **m) {
assert_se(manager_startup(tmp, NULL, NULL) >= 0);
STRV_FOREACH(test_path, tests_path) {
- rm_rf_dangerous(strappenda("/tmp/test-path_", *test_path), false, true, false);
+ rm_rf_dangerous(strjoina("/tmp/test-path_", *test_path), false, true, false);
}
*m = tmp;
@@ -201,7 +201,7 @@ static void test_path_directorynotempty(Manager *m) {
assert_se(access(test_path, F_OK) < 0);
assert_se(mkdir_p(test_path, 0755) >= 0);
- assert_se(touch(strappenda(test_path, "test_file")) >= 0);
+ assert_se(touch(strjoina(test_path, "test_file")) >= 0);
check_stop_unlink(m, unit, test_path, NULL);
}
diff --git a/src/test/test-tmpfiles.c b/src/test/test-tmpfiles.c
index 84050c6fa4..4b72c4a8fa 100644
--- a/src/test/test-tmpfiles.c
+++ b/src/test/test-tmpfiles.c
@@ -30,7 +30,7 @@
int main(int argc, char** argv) {
const char *p = argv[1] ?: "/tmp";
- char *pattern = strappenda(p, "/systemd-test-XXXXXX");
+ char *pattern = strjoina(p, "/systemd-test-XXXXXX");
_cleanup_close_ int fd, fd2;
_cleanup_free_ char *cmd, *cmd2;
diff --git a/src/test/test-util.c b/src/test/test-util.c
index f2b7038a4d..804f522e92 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -1072,17 +1072,29 @@ static void test_strshorten(void) {
assert_se(strlen(strshorten(s, 0)) == 0);
}
-static void test_strappenda(void) {
+static void test_strjoina(void) {
char *actual;
- actual = strappenda("", "foo", "bar");
+ actual = strjoina("", "foo", "bar");
assert_se(streq(actual, "foobar"));
- actual = strappenda("foo", "bar", "baz");
+ actual = strjoina("foo", "bar", "baz");
assert_se(streq(actual, "foobarbaz"));
- actual = strappenda("foo", "", "bar", "baz");
+ actual = strjoina("foo", "", "bar", "baz");
assert_se(streq(actual, "foobarbaz"));
+
+ actual = strjoina("foo");
+ assert_se(streq(actual, "foo"));
+
+ actual = strjoina(NULL);
+ assert_se(streq(actual, ""));
+
+ actual = strjoina(NULL, "foo");
+ assert_se(streq(actual, ""));
+
+ actual = strjoina("foo", NULL, "bar");
+ assert_se(streq(actual, "foo"));
}
static void test_is_symlink(void) {
@@ -1231,13 +1243,13 @@ static void test_execute_directory(void) {
assert_se(mkdtemp(template_lo));
assert_se(mkdtemp(template_hi));
- name = strappenda(template_lo, "/script");
- name2 = strappenda(template_hi, "/script2");
- name3 = strappenda(template_lo, "/useless");
- overridden = strappenda(template_lo, "/overridden");
- override = strappenda(template_hi, "/overridden");
- masked = strappenda(template_lo, "/masked");
- mask = strappenda(template_hi, "/masked");
+ name = strjoina(template_lo, "/script");
+ name2 = strjoina(template_hi, "/script2");
+ name3 = strjoina(template_lo, "/useless");
+ overridden = strjoina(template_lo, "/overridden");
+ override = strjoina(template_hi, "/overridden");
+ masked = strjoina(template_lo, "/masked");
+ mask = strjoina(template_hi, "/masked");
assert_se(write_string_file(name, "#!/bin/sh\necho 'Executing '$0\ntouch $(dirname $0)/it_works") == 0);
assert_se(write_string_file(name2, "#!/bin/sh\necho 'Executing '$0\ntouch $(dirname $0)/it_works2") == 0);
@@ -1562,7 +1574,7 @@ int main(int argc, char *argv[]) {
test_read_one_char();
test_ignore_signals();
test_strshorten();
- test_strappenda();
+ test_strjoina();
test_is_symlink();
test_pid_is_unwaited();
test_pid_is_alive();
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index b4405ce8f1..bdf651246b 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -385,7 +385,7 @@ static bool wall_tty_match(const char *path) {
_cleanup_free_ char *p = NULL;
if (!path_is_absolute(path))
- path = strappenda("/dev/", path);
+ path = strjoina("/dev/", path);
r = lstat(path, &st);
if (r < 0)
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index c310111eb9..37ff1b8008 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -153,7 +153,7 @@ static bool is_pci_multifunction(struct udev_device *dev) {
const char *filename;
uint8_t config[64];
- filename = strappenda(udev_device_get_syspath(dev), "/config");
+ filename = strjoina(udev_device_get_syspath(dev), "/config");
f = fopen(filename, "re");
if (!f)
return false;
diff --git a/src/udev/udevadm-util.c b/src/udev/udevadm-util.c
index 37e80c31df..3f0e45e26c 100644
--- a/src/udev/udevadm-util.c
+++ b/src/udev/udevadm-util.c
@@ -25,7 +25,7 @@ struct udev_device *find_device(struct udev *udev,
assert(id);
if (prefix && !startswith(id, prefix))
- id = strappenda(prefix, id);
+ id = strjoina(prefix, id);
if (startswith(id, "/dev/")) {
struct stat statbuf;