From 63c372cb9df3bee01e3bf8cd7f96f336bddda846 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Feb 2015 02:05:59 +0100 Subject: util: rework strappenda(), and rename it strjoina() After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary. --- src/machine/machine.c | 6 +++--- src/machine/machinectl.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/machine') 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'," -- cgit v1.2.3-54-g00ecf