summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coccinelle/strjoin.cocci16
-rw-r--r--src/backlight/backlight.c4
-rw-r--r--src/basic/btrfs-util.c2
-rw-r--r--src/basic/cgroup-util.c16
-rw-r--r--src/basic/conf-files.c2
-rw-r--r--src/basic/fileio.c6
-rw-r--r--src/basic/fs-util.c2
-rw-r--r--src/basic/mount-util.c2
-rw-r--r--src/basic/path-util.c12
-rw-r--r--src/basic/process-util.c6
-rw-r--r--src/basic/string-util.c2
-rw-r--r--src/basic/string-util.h3
-rw-r--r--src/basic/unit-name.c4
-rw-r--r--src/basic/util.c2
-rw-r--r--src/cgls/cgls.c2
-rw-r--r--src/cgtop/cgtop.c2
-rw-r--r--src/core/cgroup.c17
-rw-r--r--src/core/dbus-execute.c2
-rw-r--r--src/core/dbus-unit.c6
-rw-r--r--src/core/device.c2
-rw-r--r--src/core/execute.c10
-rw-r--r--src/core/locale-setup.c2
-rw-r--r--src/core/manager.c113
-rw-r--r--src/core/namespace.c2
-rw-r--r--src/core/service.c2
-rw-r--r--src/core/timer.c4
-rw-r--r--src/core/unit.c4
-rw-r--r--src/coredump/coredump.c9
-rw-r--r--src/coredump/coredumpctl.c4
-rw-r--r--src/cryptsetup/cryptsetup-generator.c12
-rw-r--r--src/cryptsetup/cryptsetup.c105
-rw-r--r--src/debug-generator/debug-generator.c4
-rw-r--r--src/delta/delta.c8
-rw-r--r--src/escape/escape.c2
-rw-r--r--src/fstab-generator/fstab-generator.c14
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c24
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c2
-rw-r--r--src/hostname/hostnamed.c2
-rw-r--r--src/hwdb/hwdb.c2
-rw-r--r--src/import/import-raw.c2
-rw-r--r--src/import/import-tar.c2
-rw-r--r--src/journal-remote/journal-gatewayd.c2
-rw-r--r--src/journal-remote/journal-upload.c4
-rw-r--r--src/journal/journalctl.c2
-rw-r--r--src/journal/journald-server.c6
-rw-r--r--src/journal/journald-wall.c2
-rw-r--r--src/journal/sd-journal.c6
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c2
-rw-r--r--src/libsystemd/sd-bus/busctl-introspect.c2
-rw-r--r--src/libsystemd/sd-bus/busctl.c4
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c6
-rw-r--r--src/libsystemd/sd-bus/test-bus-objects.c2
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c2
-rw-r--r--src/libsystemd/sd-path/sd-path.c8
-rw-r--r--src/locale/keymap-util.c6
-rw-r--r--src/login/logind-inhibit.c2
-rw-r--r--src/login/logind-session.c2
-rw-r--r--src/login/pam_systemd.c2
-rw-r--r--src/machine/machine.c2
-rw-r--r--src/mount/mount-tool.c4
-rw-r--r--src/nspawn/nspawn-mount.c20
-rw-r--r--src/nspawn/nspawn.c4
-rw-r--r--src/nss-systemd/nss-systemd.c8
-rw-r--r--src/rc-local-generator/rc-local-generator.c4
-rw-r--r--src/resolve/resolved-dns-dnssec.c2
-rw-r--r--src/resolve/resolved-dns-rr.c14
-rw-r--r--src/resolve/test-dnssec-complex.c2
-rw-r--r--src/rfkill/rfkill.c4
-rw-r--r--src/run/run.c2
-rw-r--r--src/shared/base-filesystem.c2
-rw-r--r--src/shared/bus-util.c4
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/conf-parser.c2
-rw-r--r--src/shared/dns-domain.c4
-rw-r--r--src/shared/dropin.c10
-rw-r--r--src/shared/fstab-util.c2
-rw-r--r--src/shared/install-printf.c2
-rw-r--r--src/shared/install.c10
-rw-r--r--src/shared/machine-image.c2
-rw-r--r--src/shared/path-lookup.c4
-rw-r--r--src/systemctl/systemctl.c10
-rw-r--r--src/sysv-generator/sysv-generator.c10
-rw-r--r--src/test/test-copy.c12
-rw-r--r--src/test/test-date.c4
-rw-r--r--src/test/test-fileio.c2
-rw-r--r--src/test/test-namespace.c8
-rw-r--r--src/test/test-path.c2
-rw-r--r--src/test/test-replace-var.c2
-rw-r--r--src/tmpfiles/tmpfiles.c4
-rw-r--r--src/udev/udev-builtin-hwdb.c2
-rw-r--r--src/udev/udevadm-hwdb.c2
91 files changed, 336 insertions, 331 deletions
diff --git a/coccinelle/strjoin.cocci b/coccinelle/strjoin.cocci
new file mode 100644
index 0000000000..675760e37a
--- /dev/null
+++ b/coccinelle/strjoin.cocci
@@ -0,0 +1,16 @@
+@@
+expression list args;
+@@
+- strjoin(args, NULL);
++ strjoin(args);
+@@
+expression t;
+expression list args;
+@@
+- t = strjoin(args, NULL);
++ t = strjoin(args);
+@@
+expression list args;
+@@
+- return strjoin(args, NULL);
++ return strjoin(args);
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 7c59f60d5f..c909b5bb51 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -357,9 +357,9 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- saved = strjoin("/var/lib/systemd/backlight/", escaped_path_id, ":", escaped_ss, ":", escaped_sysname, NULL);
+ saved = strjoin("/var/lib/systemd/backlight/", escaped_path_id, ":", escaped_ss, ":", escaped_sysname);
} else
- saved = strjoin("/var/lib/systemd/backlight/", escaped_ss, ":", escaped_sysname, NULL);
+ saved = strjoin("/var/lib/systemd/backlight/", escaped_ss, ":", escaped_sysname);
if (!saved) {
log_oom();
diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c
index 359d85f2e8..656bb13719 100644
--- a/src/basic/btrfs-util.c
+++ b/src/basic/btrfs-util.c
@@ -1642,7 +1642,7 @@ static int subvol_snapshot_children(int old_fd, int new_fd, const char *subvolum
if (old_child_fd < 0)
return -errno;
- np = strjoin(subvolume, "/", ino_args.name, NULL);
+ np = strjoin(subvolume, "/", ino_args.name);
if (!np)
return -ENOMEM;
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index cede835920..5fce32f769 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -345,7 +345,7 @@ int cg_kill_recursive(
while ((r = cg_read_subgroup(d, &fn)) > 0) {
_cleanup_free_ char *p = NULL;
- p = strjoin(path, "/", fn, NULL);
+ p = strjoin(path, "/", fn);
free(fn);
if (!p)
return -ENOMEM;
@@ -479,7 +479,7 @@ int cg_migrate_recursive(
while ((r = cg_read_subgroup(d, &fn)) > 0) {
_cleanup_free_ char *p = NULL;
- p = strjoin(pfrom, "/", fn, NULL);
+ p = strjoin(pfrom, "/", fn);
free(fn);
if (!p)
return -ENOMEM;
@@ -562,11 +562,11 @@ static int join_path_legacy(const char *controller, const char *path, const char
if (isempty(path) && isempty(suffix))
t = strappend("/sys/fs/cgroup/", dn);
else if (isempty(path))
- t = strjoin("/sys/fs/cgroup/", dn, "/", suffix, NULL);
+ t = strjoin("/sys/fs/cgroup/", dn, "/", suffix);
else if (isempty(suffix))
- t = strjoin("/sys/fs/cgroup/", dn, "/", path, NULL);
+ t = strjoin("/sys/fs/cgroup/", dn, "/", path);
else
- t = strjoin("/sys/fs/cgroup/", dn, "/", path, "/", suffix, NULL);
+ t = strjoin("/sys/fs/cgroup/", dn, "/", path, "/", suffix);
if (!t)
return -ENOMEM;
@@ -586,7 +586,7 @@ static int join_path_unified(const char *path, const char *suffix, char **fs) {
else if (isempty(suffix))
t = strappend("/sys/fs/cgroup/", path);
else
- t = strjoin("/sys/fs/cgroup/", path, "/", suffix, NULL);
+ t = strjoin("/sys/fs/cgroup/", path, "/", suffix);
if (!t)
return -ENOMEM;
@@ -613,7 +613,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
else if (!path)
t = strdup(suffix);
else
- t = strjoin(path, "/", suffix, NULL);
+ t = strjoin(path, "/", suffix);
if (!t)
return -ENOMEM;
@@ -1145,7 +1145,7 @@ int cg_is_empty_recursive(const char *controller, const char *path) {
while ((r = cg_read_subgroup(d, &fn)) > 0) {
_cleanup_free_ char *p = NULL;
- p = strjoin(path, "/", fn, NULL);
+ p = strjoin(path, "/", fn);
free(fn);
if (!p)
return -ENOMEM;
diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c
index c781610e14..c0c22610d7 100644
--- a/src/basic/conf-files.c
+++ b/src/basic/conf-files.c
@@ -60,7 +60,7 @@ static int files_add(Hashmap *h, const char *root, const char *path, const char
if (!dirent_is_file_with_suffix(de, suffix))
continue;
- p = strjoin(dirpath, "/", de->d_name, NULL);
+ p = strjoin(dirpath, "/", de->d_name);
if (!p)
return -ENOMEM;
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 1cfb7a98f5..1615456659 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -676,7 +676,7 @@ static int load_env_file_push(
return -EINVAL;
}
- p = strjoin(key, "=", strempty(value), NULL);
+ p = strjoin(key, "=", strempty(value));
if (!p)
return -ENOMEM;
@@ -963,9 +963,9 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
FILE *f;
if (root)
- p = strjoin(root, *i, "/", path, NULL);
+ p = strjoin(root, *i, "/", path);
else
- p = strjoin(*i, "/", path, NULL);
+ p = strjoin(*i, "/", path);
if (!p)
return -ENOMEM;
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 48952a1c26..d2c322a0de 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -742,7 +742,7 @@ int chase_symlinks(const char *path, const char *_root, char **ret) {
/* A relative destination. If so, this is what we'll prefix what's left to do with what
* we just read, and start the loop again, but remain in the current directory. */
- joined = strjoin("/", destination, todo, NULL);
+ joined = strjoin("/", destination, todo);
if (!joined)
return -ENOMEM;
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index c8f8022578..5d37fb48be 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -642,7 +642,7 @@ static char* mount_flags_to_string(long unsigned flags) {
FLAG(MS_I_VERSION),
FLAG(MS_STRICTATIME),
FLAG(MS_LAZYTIME),
- y, NULL);
+ y);
if (!x)
return NULL;
if (!y)
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index fd38f51c4c..5cdac50c68 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -83,7 +83,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
if (path_is_absolute(p) || !prefix)
return strdup(p);
- return strjoin(prefix, "/", p, NULL);
+ return strjoin(prefix, "/", p);
}
int path_make_absolute_cwd(const char *p, char **ret) {
@@ -104,7 +104,7 @@ int path_make_absolute_cwd(const char *p, char **ret) {
if (!cwd)
return negative_errno();
- c = strjoin(cwd, "/", p, NULL);
+ c = strjoin(cwd, "/", p);
}
if (!c)
return -ENOMEM;
@@ -454,13 +454,11 @@ char* path_join(const char *root, const char *path, const char *rest) {
return strjoin(root, endswith(root, "/") ? "" : "/",
path[0] == '/' ? path+1 : path,
rest ? (endswith(path, "/") ? "" : "/") : NULL,
- rest && rest[0] == '/' ? rest+1 : rest,
- NULL);
+ rest && rest[0] == '/' ? rest+1 : rest);
else
return strjoin(path,
rest ? (endswith(path, "/") ? "" : "/") : NULL,
- rest && rest[0] == '/' ? rest+1 : rest,
- NULL);
+ rest && rest[0] == '/' ? rest+1 : rest);
}
int find_binary(const char *name, char **ret) {
@@ -504,7 +502,7 @@ int find_binary(const char *name, char **ret) {
if (!path_is_absolute(element))
continue;
- j = strjoin(element, "/", name, NULL);
+ j = strjoin(element, "/", name);
if (!j)
return -ENOMEM;
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 54b644ad56..48a5c719af 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -236,14 +236,14 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
return h;
if (max_length == 0)
- r = strjoin("[", t, "]", NULL);
+ r = strjoin("[", t, "]");
else {
size_t l;
l = strlen(t);
if (l + 3 <= max_length)
- r = strjoin("[", t, "]", NULL);
+ r = strjoin("[", t, "]");
else if (max_length <= 6) {
r = new(char, max_length);
@@ -263,7 +263,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
e--;
*e = 0;
- r = strjoin("[", t, "...]", NULL);
+ r = strjoin("[", t, "...]");
}
}
if (!r)
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index 6b06e643c9..2ba3604ba0 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -218,7 +218,7 @@ char *strappend(const char *s, const char *suffix) {
return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
}
-char *strjoin(const char *x, ...) {
+char *strjoin_real(const char *x, ...) {
va_list ap;
size_t l;
char *r, *p;
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index d029d538bd..0175803302 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -116,7 +116,8 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo
char *strappend(const char *s, const char *suffix);
char *strnappend(const char *s, const char *suffix, size_t length);
-char *strjoin(const char *x, ...) _sentinel_;
+char *strjoin_real(const char *x, ...) _sentinel_;
+#define strjoin(a, ...) strjoin_real((a), __VA_ARGS__, NULL)
#define strjoina(a, ...) \
({ \
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index fe883b95c7..0a6efa449a 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -273,7 +273,7 @@ int unit_name_build(const char *prefix, const char *instance, const char *suffix
if (!instance)
s = strappend(prefix, suffix);
else
- s = strjoin(prefix, "@", instance, suffix, NULL);
+ s = strjoin(prefix, "@", instance, suffix);
if (!s)
return -ENOMEM;
@@ -554,7 +554,7 @@ int unit_name_from_path_instance(const char *prefix, const char *path, const cha
if (r < 0)
return r;
- s = strjoin(prefix, "@", p, suffix, NULL);
+ s = strjoin(prefix, "@", p, suffix);
if (!s)
return -ENOMEM;
diff --git a/src/basic/util.c b/src/basic/util.c
index ec7939dc83..0f65e4839c 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -131,7 +131,7 @@ static int do_execute(char **directories, usec_t timeout, char *argv[]) {
if (r < 0)
return log_oom();
- path = strjoin(*directory, "/", de->d_name, NULL);
+ path = strjoin(*directory, "/", de->d_name);
if (!path)
return log_oom();
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index adf488e8e1..b55aa86a40 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -223,7 +223,7 @@ int main(int argc, char *argv[]) {
controller = c ?: SYSTEMD_CGROUP_CONTROLLER;
if (p) {
- j = strjoin(root, "/", p, NULL);
+ j = strjoin(root, "/", p);
if (!j) {
r = log_oom();
goto finish;
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index aba17c9829..af5c3d8695 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -431,7 +431,7 @@ static int refresh_one(
if (r == 0)
break;
- p = strjoin(path, "/", fn, NULL);
+ p = strjoin(path, "/", fn);
if (!p)
return -ENOMEM;
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 23a92f9651..bd6248406f 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -928,7 +928,7 @@ static void cgroup_context_apply(Unit *u, CGroupMask mask, ManagerState state) {
}
LIST_FOREACH(device_allow, a, c->device_allow) {
- char acc[4];
+ char acc[4], *val;
unsigned k = 0;
if (a->r)
@@ -945,10 +945,10 @@ static void cgroup_context_apply(Unit *u, CGroupMask mask, ManagerState state) {
if (startswith(a->path, "/dev/"))
whitelist_device(path, a->path, acc);
- else if (startswith(a->path, "block-"))
- whitelist_major(path, a->path + 6, 'b', acc);
- else if (startswith(a->path, "char-"))
- whitelist_major(path, a->path + 5, 'c', acc);
+ else if ((val = startswith(a->path, "block-")))
+ whitelist_major(path, val, 'b', acc);
+ else if ((val = startswith(a->path, "char-")))
+ whitelist_major(path, val, 'c', acc);
else
log_unit_debug(u, "Ignoring device %s while writing cgroup attribute.", a->path);
}
@@ -1201,9 +1201,10 @@ char *unit_default_cgroup_path(Unit *u) {
return NULL;
if (slice)
- return strjoin(u->manager->cgroup_root, "/", slice, "/", escaped, NULL);
+ return strjoin(u->manager->cgroup_root, "/", slice, "/",
+ escaped);
else
- return strjoin(u->manager->cgroup_root, "/", escaped, NULL);
+ return strjoin(u->manager->cgroup_root, "/", escaped);
}
int unit_set_cgroup_path(Unit *u, const char *path) {
@@ -1643,7 +1644,7 @@ static int unit_watch_pids_in_path(Unit *u, const char *path) {
while ((r = cg_read_subgroup(d, &fn)) > 0) {
_cleanup_free_ char *p = NULL;
- p = strjoin(path, "/", fn, NULL);
+ p = strjoin(path, "/", fn);
free(fn);
if (!p)
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 1a7f770db1..03f23780c1 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -1368,7 +1368,7 @@ int bus_exec_context_set_transient_property(
if (mode != UNIT_CHECK) {
char *buf = NULL;
- buf = strjoin(b ? "-" : "", path, NULL);
+ buf = strjoin(b ? "-" : "", path);
if (!buf)
return -ENOMEM;
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 69e249c844..b6cb6e1350 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -481,7 +481,7 @@ int bus_unit_method_start_generic(
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode);
if (reload_if_possible)
- verb = strjoin("reload-or-", job_type_to_string(job_type), NULL);
+ verb = strjoin("reload-or-", job_type_to_string(job_type));
else
verb = strdup(job_type_to_string(job_type));
if (!verb)
@@ -984,7 +984,7 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) {
if (r == 0)
break;
- j = strjoin(p, "/", g, NULL);
+ j = strjoin(p, "/", g);
if (!j)
return -ENOMEM;
@@ -1363,7 +1363,7 @@ static int bus_unit_set_transient_property(
if (r < 0)
return r;
- label = strjoin(name, "-", other, NULL);
+ label = strjoin(name, "-", other);
if (!label)
return -ENOMEM;
diff --git a/src/core/device.c b/src/core/device.c
index bd87a447cd..498351af11 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -239,7 +239,7 @@ static int device_update_description(Unit *u, struct udev_device *dev, const cha
if (label) {
_cleanup_free_ char *j;
- j = strjoin(model, " ", label, NULL);
+ j = strjoin(model, " ", label);
if (j)
r = unit_set_description(u, j);
else
diff --git a/src/core/execute.c b/src/core/execute.c
index f13ca30395..5bb23e2e4a 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1603,7 +1603,7 @@ static int build_environment(
if (!joined)
return -ENOMEM;
- x = strjoin("LISTEN_FDNAMES=", joined, NULL);
+ x = strjoin("LISTEN_FDNAMES=", joined);
if (!x)
return -ENOMEM;
our_env[n_env++] = x;
@@ -1710,7 +1710,7 @@ static int build_pass_environment(const ExecContext *c, char ***ret) {
v = getenv(*i);
if (!v)
continue;
- x = strjoin(*i, "=", v, NULL);
+ x = strjoin(*i, "=", v);
if (!x)
return -ENOMEM;
if (!GREEDY_REALLOC(pass_env, n_bufsize, n_env + 2))
@@ -1924,7 +1924,7 @@ static int setup_runtime_directory(
STRV_FOREACH(rt, context->runtime_directory) {
_cleanup_free_ char *p;
- p = strjoin(params->runtime_prefix, "/", *rt, NULL);
+ p = strjoin(params->runtime_prefix, "/", *rt);
if (!p)
return -ENOMEM;
@@ -2000,7 +2000,7 @@ static int compile_read_write_paths(
STRV_FOREACH(rt, context->runtime_directory) {
char *s;
- s = strjoin(params->runtime_prefix, "/", *rt, NULL);
+ s = strjoin(params->runtime_prefix, "/", *rt);
if (!s)
return -ENOMEM;
@@ -3004,7 +3004,7 @@ int exec_context_destroy_runtime_directory(ExecContext *c, const char *runtime_p
STRV_FOREACH(i, c->runtime_directory) {
_cleanup_free_ char *p;
- p = strjoin(runtime_prefix, "/", *i, NULL);
+ p = strjoin(runtime_prefix, "/", *i);
if (!p)
return -ENOMEM;
diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c
index ccf61d29fb..fdd847ee8b 100644
--- a/src/core/locale-setup.c
+++ b/src/core/locale-setup.c
@@ -87,7 +87,7 @@ int locale_setup(char ***environment) {
if (!variables[i])
continue;
- s = strjoin(locale_variable_to_string(i), "=", variables[i], NULL);
+ s = strjoin(locale_variable_to_string(i), "=", variables[i]);
if (!s) {
r = -ENOMEM;
goto finish;
diff --git a/src/core/manager.c b/src/core/manager.c
index ffccfdcd5e..52174eac07 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1196,7 +1196,7 @@ static void manager_build_unit_path_cache(Manager *m) {
FOREACH_DIRENT(de, d, r = -errno; goto fail) {
char *p;
- p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
+ p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name);
if (!p) {
r = -ENOMEM;
goto fail;
@@ -2565,6 +2565,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
for (;;) {
char line[LINE_MAX], *l;
+ const char *val;
if (!fgets(line, sizeof(line), f)) {
if (feof(f))
@@ -2581,63 +2582,63 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
if (l[0] == 0)
break;
- if (startswith(l, "current-job-id=")) {
+ if ((val = startswith(l, "current-job-id="))) {
uint32_t id;
- if (safe_atou32(l+15, &id) < 0)
- log_debug("Failed to parse current job id value %s", l+15);
+ if (safe_atou32(val, &id) < 0)
+ log_debug("Failed to parse current job id value %s", val);
else
m->current_job_id = MAX(m->current_job_id, id);
- } else if (startswith(l, "n-installed-jobs=")) {
+ } else if ((val = startswith(l, "n-installed-jobs="))) {
uint32_t n;
- if (safe_atou32(l+17, &n) < 0)
- log_debug("Failed to parse installed jobs counter %s", l+17);
+ if (safe_atou32(val, &n) < 0)
+ log_debug("Failed to parse installed jobs counter %s", val);
else
m->n_installed_jobs += n;
- } else if (startswith(l, "n-failed-jobs=")) {
+ } else if ((val = startswith(l, "n-failed-jobs="))) {
uint32_t n;
- if (safe_atou32(l+14, &n) < 0)
- log_debug("Failed to parse failed jobs counter %s", l+14);
+ if (safe_atou32(val, &n) < 0)
+ log_debug("Failed to parse failed jobs counter %s", val);
else
m->n_failed_jobs += n;
- } else if (startswith(l, "taint-usr=")) {
+ } else if ((val = startswith(l, "taint-usr="))) {
int b;
- b = parse_boolean(l+10);
+ b = parse_boolean(val);
if (b < 0)
- log_debug("Failed to parse taint /usr flag %s", l+10);
+ log_debug("Failed to parse taint /usr flag %s", val);
else
m->taint_usr = m->taint_usr || b;
- } else if (startswith(l, "firmware-timestamp="))
- dual_timestamp_deserialize(l+19, &m->firmware_timestamp);
- else if (startswith(l, "loader-timestamp="))
- dual_timestamp_deserialize(l+17, &m->loader_timestamp);
- else if (startswith(l, "kernel-timestamp="))
- dual_timestamp_deserialize(l+17, &m->kernel_timestamp);
- else if (startswith(l, "initrd-timestamp="))
- dual_timestamp_deserialize(l+17, &m->initrd_timestamp);
- else if (startswith(l, "userspace-timestamp="))
- dual_timestamp_deserialize(l+20, &m->userspace_timestamp);
- else if (startswith(l, "finish-timestamp="))
- dual_timestamp_deserialize(l+17, &m->finish_timestamp);
- else if (startswith(l, "security-start-timestamp="))
- dual_timestamp_deserialize(l+25, &m->security_start_timestamp);
- else if (startswith(l, "security-finish-timestamp="))
- dual_timestamp_deserialize(l+26, &m->security_finish_timestamp);
- else if (startswith(l, "generators-start-timestamp="))
- dual_timestamp_deserialize(l+27, &m->generators_start_timestamp);
- else if (startswith(l, "generators-finish-timestamp="))
- dual_timestamp_deserialize(l+28, &m->generators_finish_timestamp);
- else if (startswith(l, "units-load-start-timestamp="))
- dual_timestamp_deserialize(l+27, &m->units_load_start_timestamp);
- else if (startswith(l, "units-load-finish-timestamp="))
- dual_timestamp_deserialize(l+28, &m->units_load_finish_timestamp);
+ } else if ((val = startswith(l, "firmware-timestamp=")))
+ dual_timestamp_deserialize(val, &m->firmware_timestamp);
+ else if ((val = startswith(l, "loader-timestamp=")))
+ dual_timestamp_deserialize(val, &m->loader_timestamp);
+ else if ((val = startswith(l, "kernel-timestamp=")))
+ dual_timestamp_deserialize(val, &m->kernel_timestamp);
+ else if ((val = startswith(l, "initrd-timestamp=")))
+ dual_timestamp_deserialize(val, &m->initrd_timestamp);
+ else if ((val = startswith(l, "userspace-timestamp=")))
+ dual_timestamp_deserialize(val, &m->userspace_timestamp);
+ else if ((val = startswith(l, "finish-timestamp=")))
+ dual_timestamp_deserialize(val, &m->finish_timestamp);
+ else if ((val = startswith(l, "security-start-timestamp=")))
+ dual_timestamp_deserialize(val, &m->security_start_timestamp);
+ else if ((val = startswith(l, "security-finish-timestamp=")))
+ dual_timestamp_deserialize(val, &m->security_finish_timestamp);
+ else if ((val = startswith(l, "generators-start-timestamp=")))
+ dual_timestamp_deserialize(val, &m->generators_start_timestamp);
+ else if ((val = startswith(l, "generators-finish-timestamp=")))
+ dual_timestamp_deserialize(val, &m->generators_finish_timestamp);
+ else if ((val = startswith(l, "units-load-start-timestamp=")))
+ dual_timestamp_deserialize(val, &m->units_load_start_timestamp);
+ else if ((val = startswith(l, "units-load-finish-timestamp=")))
+ dual_timestamp_deserialize(val, &m->units_load_finish_timestamp);
else if (startswith(l, "env=")) {
_cleanup_free_ char *uce = NULL;
char **e;
@@ -2655,21 +2656,21 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
strv_free(m->environment);
m->environment = e;
- } else if (startswith(l, "notify-fd=")) {
+ } else if ((val = startswith(l, "notify-fd="))) {
int fd;
- if (safe_atoi(l + 10, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug("Failed to parse notify fd: %s", l + 10);
+ if (safe_atoi(val, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
+ log_debug("Failed to parse notify fd: %s", val);
else {
m->notify_event_source = sd_event_source_unref(m->notify_event_source);
safe_close(m->notify_fd);
m->notify_fd = fdset_remove(fds, fd);
}
- } else if (startswith(l, "notify-socket=")) {
+ } else if ((val = startswith(l, "notify-socket="))) {
char *n;
- n = strdup(l+14);
+ n = strdup(val);
if (!n) {
r = -ENOMEM;
goto finish;
@@ -2678,22 +2679,22 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
free(m->notify_socket);
m->notify_socket = n;
- } else if (startswith(l, "cgroups-agent-fd=")) {
+ } else if ((val = startswith(l, "cgroups-agent-fd="))) {
int fd;
- if (safe_atoi(l + 17, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_debug("Failed to parse cgroups agent fd: %s", l + 10);
+ if (safe_atoi(val, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
+ log_debug("Failed to parse cgroups agent fd: %s", val);
else {
m->cgroups_agent_event_source = sd_event_source_unref(m->cgroups_agent_event_source);
safe_close(m->cgroups_agent_fd);
m->cgroups_agent_fd = fdset_remove(fds, fd);
}
- } else if (startswith(l, "user-lookup=")) {
+ } else if ((val = startswith(l, "user-lookup="))) {
int fd0, fd1;
- if (sscanf(l + 12, "%i %i", &fd0, &fd1) != 2 || fd0 < 0 || fd1 < 0 || fd0 == fd1 || !fdset_contains(fds, fd0) || !fdset_contains(fds, fd1))
- log_debug("Failed to parse user lookup fd: %s", l + 12);
+ if (sscanf(val, "%i %i", &fd0, &fd1) != 2 || fd0 < 0 || fd1 < 0 || fd0 == fd1 || !fdset_contains(fds, fd0) || !fdset_contains(fds, fd1))
+ log_debug("Failed to parse user lookup fd: %s", val);
else {
m->user_lookup_event_source = sd_event_source_unref(m->user_lookup_event_source);
safe_close_pair(m->user_lookup_fds);
@@ -2701,15 +2702,15 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
m->user_lookup_fds[1] = fdset_remove(fds, fd1);
}
- } else if (startswith(l, "dynamic-user="))
- dynamic_user_deserialize_one(m, l + 13, fds);
- else if (startswith(l, "destroy-ipc-uid="))
- manager_deserialize_uid_refs_one(m, l + 16);
- else if (startswith(l, "destroy-ipc-gid="))
- manager_deserialize_gid_refs_one(m, l + 16);
- else if (startswith(l, "subscribed=")) {
+ } else if ((val = startswith(l, "dynamic-user=")))
+ dynamic_user_deserialize_one(m, val, fds);
+ else if ((val = startswith(l, "destroy-ipc-uid=")))
+ manager_deserialize_uid_refs_one(m, val);
+ else if ((val = startswith(l, "destroy-ipc-gid=")))
+ manager_deserialize_gid_refs_one(m, val);
+ else if ((val = startswith(l, "subscribed="))) {
- if (strv_extend(&m->deserialized_subscribed, l+11) < 0)
+ if (strv_extend(&m->deserialized_subscribed, val) < 0)
log_oom();
} else if (!startswith(l, "kdbus-fd=")) /* ignore this one */
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 1195e9a854..db9a7aa5e7 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -909,7 +909,7 @@ static int setup_one_tmp_dir(const char *id, const char *prefix, char **path) {
if (r < 0)
return r;
- x = strjoin(prefix, "/systemd-private-", sd_id128_to_string(boot_id, bid), "-", id, "-XXXXXX", NULL);
+ x = strjoin(prefix, "/systemd-private-", sd_id128_to_string(boot_id, bid), "-", id, "-XXXXXX");
if (!x)
return -ENOMEM;
diff --git a/src/core/service.c b/src/core/service.c
index a7274a758f..f6acc2f129 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3273,7 +3273,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context
if (UNIT(s)->description) {
_cleanup_free_ char *a;
- a = strjoin(UNIT(s)->description, " (", peer, ")", NULL);
+ a = strjoin(UNIT(s)->description, " (", peer, ")");
if (!a)
return -ENOMEM;
diff --git a/src/core/timer.c b/src/core/timer.c
index 2469a517ea..c6b28dd9c5 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -147,7 +147,7 @@ static int timer_setup_persistent(Timer *t) {
e = getenv("XDG_DATA_HOME");
if (e)
- t->stamp_path = strjoin(e, "/systemd/timers/stamp-", UNIT(t)->id, NULL);
+ t->stamp_path = strjoin(e, "/systemd/timers/stamp-", UNIT(t)->id);
else {
_cleanup_free_ char *h = NULL;
@@ -156,7 +156,7 @@ static int timer_setup_persistent(Timer *t) {
if (r < 0)
return log_unit_error_errno(UNIT(t), r, "Failed to determine home directory: %m");
- t->stamp_path = strjoin(h, "/.local/share/systemd/timers/stamp-", UNIT(t)->id, NULL);
+ t->stamp_path = strjoin(h, "/.local/share/systemd/timers/stamp-", UNIT(t)->id);
}
}
diff --git a/src/core/unit.c b/src/core/unit.c
index e664e23892..fa1f3d9d4b 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2510,7 +2510,7 @@ int unit_set_default_slice(Unit *u) {
return -ENOMEM;
if (MANAGER_IS_SYSTEM(u->manager))
- b = strjoin("system-", escaped, ".slice", NULL);
+ b = strjoin("system-", escaped, ".slice");
else
b = strappend(escaped, ".slice");
if (!b)
@@ -3670,7 +3670,7 @@ int unit_make_transient(Unit *u) {
if (!UNIT_VTABLE(u)->can_transient)
return -EOPNOTSUPP;
- path = strjoin(u->manager->lookup_paths.transient, "/", u->id, NULL);
+ path = strjoin(u->manager->lookup_paths.transient, "/", u->id);
if (!path)
return -ENOMEM;
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index a982c204be..6bd0e925eb 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -729,7 +729,10 @@ static int submit_coredump(
r = coredump_make_stack_trace(coredump_fd, context[CONTEXT_EXE], &stacktrace);
if (r >= 0)
- core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID], " (", context[CONTEXT_COMM], ") of user ", context[CONTEXT_UID], " dumped core.\n\n", stacktrace, NULL);
+ core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID],
+ " (", context[CONTEXT_COMM], ") of user ",
+ context[CONTEXT_UID], " dumped core.\n\n",
+ stacktrace);
else if (r == -EINVAL)
log_warning("Failed to generate stack trace: %s", dwfl_errmsg(dwfl_errno()));
else
@@ -741,7 +744,9 @@ static int submit_coredump(
if (!core_message)
#endif
log:
- core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID], " (", context[CONTEXT_COMM], ") of user ", context[CONTEXT_UID], " dumped core.", NULL);
+ core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID], " (",
+ context[CONTEXT_COMM], ") of user ",
+ context[CONTEXT_UID], " dumped core.");
if (core_message)
IOVEC_SET_STRING(iovec[n_iovec++], core_message);
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index 0e5351e621..877bbb34fc 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -108,7 +108,7 @@ static int add_match(Set *set, const char *match) {
else
prefix = "COREDUMP_COMM=";
- pattern = strjoin(prefix, match, NULL);
+ pattern = strjoin(prefix, match);
if (!pattern) {
r = -ENOMEM;
goto fail;
@@ -667,7 +667,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
if (r < 0)
return log_error_errno(r, "Failed to acquire temporary directory path: %m");
- temp = strjoin(vt, "/coredump-XXXXXX", NULL);
+ temp = strjoin(vt, "/coredump-XXXXXX");
if (!temp)
return log_oom();
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index e2dc4327fe..68029865a0 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -86,7 +86,7 @@ static int create_disk(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- p = strjoin(arg_dest, "/", n, NULL);
+ p = strjoin(arg_dest, "/", n);
if (!p)
return log_oom();
@@ -188,7 +188,7 @@ static int create_disk(
if (!noauto) {
- to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
+ to = strjoin(arg_dest, "/", d, ".wants/", n);
if (!to)
return log_oom();
@@ -198,9 +198,9 @@ static int create_disk(
free(to);
if (!nofail)
- to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL);
+ to = strjoin(arg_dest, "/cryptsetup.target.requires/", n);
else
- to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL);
+ to = strjoin(arg_dest, "/cryptsetup.target.wants/", n);
if (!to)
return log_oom();
@@ -210,7 +210,7 @@ static int create_disk(
}
free(to);
- to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL);
+ to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n);
if (!to)
return log_oom();
@@ -220,7 +220,7 @@ static int create_disk(
if (!noauto && !nofail) {
_cleanup_free_ char *dmname;
- dmname = strjoin("dev-mapper-", e, ".device", NULL);
+ dmname = strjoin("dev-mapper-", e, ".device");
if (!dmname)
return log_oom();
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index ff5a3f36fb..01e7ee9973 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -69,26 +69,25 @@ static usec_t arg_timeout = 0;
*/
static int parse_one_option(const char *option) {
+ const char *val;
+ int r;
+
assert(option);
/* Handled outside of this tool */
if (STR_IN_SET(option, "noauto", "auto", "nofail", "fail"))
return 0;
- if (startswith(option, "cipher=")) {
- char *t;
-
- t = strdup(option+7);
- if (!t)
+ if ((val = startswith(option, "cipher="))) {
+ r = free_and_strdup(&arg_cipher, val);
+ if (r < 0)
return log_oom();
- free(arg_cipher);
- arg_cipher = t;
-
- } else if (startswith(option, "size=")) {
+ } else if ((val = startswith(option, "size="))) {
- if (safe_atou(option+5, &arg_key_size) < 0) {
- log_error("size= parse failure, ignoring.");
+ r = safe_atou(val, &arg_key_size);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
@@ -99,68 +98,67 @@ static int parse_one_option(const char *option) {
arg_key_size /= 8;
- } else if (startswith(option, "key-slot=")) {
+ } else if ((val = startswith(option, "key-slot="))) {
arg_type = CRYPT_LUKS1;
- if (safe_atoi(option+9, &arg_key_slot) < 0) {
- log_error("key-slot= parse failure, ignoring.");
+ r = safe_atoi(val, &arg_key_slot);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
- } else if (startswith(option, "tcrypt-keyfile=")) {
+ } else if ((val = startswith(option, "tcrypt-keyfile="))) {
arg_type = CRYPT_TCRYPT;
- if (path_is_absolute(option+15)) {
- if (strv_extend(&arg_tcrypt_keyfiles, option + 15) < 0)
+ if (path_is_absolute(val)) {
+ if (strv_extend(&arg_tcrypt_keyfiles, val) < 0)
return log_oom();
} else
- log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
+ log_error("Key file path \"%s\" is not absolute. Ignoring.", val);
- } else if (startswith(option, "keyfile-size=")) {
+ } else if ((val = startswith(option, "keyfile-size="))) {
- if (safe_atou(option+13, &arg_keyfile_size) < 0) {
- log_error("keyfile-size= parse failure, ignoring.");
+ r = safe_atou(val, &arg_keyfile_size);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
- } else if (startswith(option, "keyfile-offset=")) {
+ } else if ((val = startswith(option, "keyfile-offset="))) {
- if (safe_atou(option+15, &arg_keyfile_offset) < 0) {
- log_error("keyfile-offset= parse failure, ignoring.");
+ r = safe_atou(val, &arg_keyfile_offset);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
- } else if (startswith(option, "hash=")) {
- char *t;
-
- t = strdup(option+5);
- if (!t)
+ } else if ((val = startswith(option, "hash="))) {
+ r = free_and_strdup(&arg_hash, val);
+ if (r < 0)
return log_oom();
- free(arg_hash);
- arg_hash = t;
-
- } else if (startswith(option, "header=")) {
+ } else if ((val = startswith(option, "header="))) {
arg_type = CRYPT_LUKS1;
- if (!path_is_absolute(option+7)) {
- log_error("Header path '%s' is not absolute, refusing.", option+7);
+ if (!path_is_absolute(val)) {
+ log_error("Header path \"%s\" is not absolute, refusing.", val);
return -EINVAL;
}
if (arg_header) {
- log_error("Duplicate header= options, refusing.");
+ log_error("Duplicate header= option, refusing.");
return -EINVAL;
}
- arg_header = strdup(option+7);
+ arg_header = strdup(val);
if (!arg_header)
return log_oom();
- } else if (startswith(option, "tries=")) {
+ } else if ((val = startswith(option, "tries="))) {
- if (safe_atou(option+6, &arg_tries) < 0) {
- log_error("tries= parse failure, ignoring.");
+ r = safe_atou(val, &arg_tries);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
@@ -190,29 +188,28 @@ static int parse_one_option(const char *option) {
#endif
} else if (STR_IN_SET(option, "plain", "swap", "tmp"))
arg_type = CRYPT_PLAIN;
- else if (startswith(option, "timeout=")) {
+ else if ((val = startswith(option, "timeout="))) {
- if (parse_sec(option+8, &arg_timeout) < 0) {
- log_error("timeout= parse failure, ignoring.");
+ r = parse_sec(val, &arg_timeout);
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;
}
- } else if (startswith(option, "offset=")) {
+ } else if ((val = startswith(option, "offset="))) {
- if (safe_atou64(option+7, &arg_offset) < 0) {
- log_error("offset= parse failure, refusing.");
- return -EINVAL;
- }
+ r = safe_atou64(val, &arg_offset);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse %s: %m", option);
- } else if (startswith(option, "skip=")) {
+ } else if ((val = startswith(option, "skip="))) {
- if (safe_atou64(option+5, &arg_skip) < 0) {
- log_error("skip= parse failure, refusing.");
- return -EINVAL;
- }
+ r = safe_atou64(val, &arg_skip);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse %s: %m", option);
} else if (!streq(option, "none"))
- log_error("Encountered unknown /etc/crypttab option '%s', ignoring.", option);
+ log_warning("Encountered unknown /etc/crypttab option '%s', ignoring.", option);
return 0;
}
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c
index 7f11ec724d..1ee3471355 100644
--- a/src/debug-generator/debug-generator.c
+++ b/src/debug-generator/debug-generator.c
@@ -113,7 +113,7 @@ static int generate_mask_symlinks(void) {
STRV_FOREACH(u, arg_mask) {
_cleanup_free_ char *p = NULL;
- p = strjoin(arg_dest, "/", *u, NULL);
+ p = strjoin(arg_dest, "/", *u);
if (!p)
return log_oom();
@@ -136,7 +136,7 @@ static int generate_wants_symlinks(void) {
STRV_FOREACH(u, arg_wants) {
_cleanup_free_ char *p = NULL, *f = NULL;
- p = strjoin(arg_dest, "/", arg_default_unit, ".wants/", *u, NULL);
+ p = strjoin(arg_dest, "/", arg_default_unit, ".wants/", *u);
if (!p)
return log_oom();
diff --git a/src/delta/delta.c b/src/delta/delta.c
index f32744def2..6848662ccb 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -214,7 +214,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const
assert(!endswith(drop, "/"));
- path = strjoin(toppath, "/", drop, NULL);
+ path = strjoin(toppath, "/", drop);
if (!path)
return -ENOMEM;
@@ -242,7 +242,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const
if (!endswith(*file, ".conf"))
continue;
- p = strjoin(path, "/", *file, NULL);
+ p = strjoin(path, "/", *file);
if (!p)
return -ENOMEM;
d = p + strlen(toppath) + 1;
@@ -330,7 +330,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch
if (!dirent_is_file(de))
continue;
- p = strjoin(path, "/", de->d_name, NULL);
+ p = strjoin(path, "/", de->d_name);
if (!p)
return -ENOMEM;
@@ -383,7 +383,7 @@ static int process_suffix(const char *suffix, const char *onlyprefix) {
NULSTR_FOREACH(p, prefixes) {
_cleanup_free_ char *t = NULL;
- t = strjoin(p, "/", suffix, NULL);
+ t = strjoin(p, "/", suffix);
if (!t) {
r = -ENOMEM;
goto finish;
diff --git a/src/escape/escape.c b/src/escape/escape.c
index 9f39049577..af98c98e40 100644
--- a/src/escape/escape.c
+++ b/src/escape/escape.c
@@ -191,7 +191,7 @@ int main(int argc, char *argv[]) {
} else if (arg_suffix) {
char *x;
- x = strjoin(e, ".", arg_suffix, NULL);
+ x = strjoin(e, ".", arg_suffix);
if (!x) {
r = log_oom();
goto finish;
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index e77bd71a52..46507de937 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -80,7 +80,7 @@ static int add_swap(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- unit = strjoin(arg_dest, "/", name, NULL);
+ unit = strjoin(arg_dest, "/", name);
if (!unit)
return log_oom();
@@ -275,7 +275,7 @@ static int add_mount(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- unit = strjoin(arg_dest, "/", name, NULL);
+ unit = strjoin(arg_dest, "/", name);
if (!unit)
return log_oom();
@@ -335,7 +335,7 @@ static int add_mount(
return log_error_errno(r, "Failed to write unit file %s: %m", unit);
if (!noauto && !automount) {
- lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", name, NULL);
+ lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", name);
if (!lnk)
return log_oom();
@@ -349,7 +349,7 @@ static int add_mount(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- automount_unit = strjoin(arg_dest, "/", automount_name, NULL);
+ automount_unit = strjoin(arg_dest, "/", automount_name);
if (!automount_unit)
return log_oom();
@@ -391,7 +391,7 @@ static int add_mount(
return log_error_errno(r, "Failed to write unit file %s: %m", automount_unit);
free(lnk);
- lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);
+ lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name);
if (!lnk)
return log_oom();
@@ -619,7 +619,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
char *o;
o = arg_root_options ?
- strjoin(arg_root_options, ",", value, NULL) :
+ strjoin(arg_root_options, ",", value) :
strdup(value);
if (!o)
return log_oom();
@@ -641,7 +641,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
char *o;
o = arg_usr_options ?
- strjoin(arg_usr_options, ",", value, NULL) :
+ strjoin(arg_usr_options, ",", value) :
strdup(value);
if (!o)
return log_oom();
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index a098b27a8e..e64d5bb231 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -76,7 +76,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- p = strjoin(arg_dest, "/", n, NULL);
+ p = strjoin(arg_dest, "/", n);
if (!p)
return log_oom();
@@ -111,7 +111,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
from = strjoina("../", n);
- to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
+ to = strjoin(arg_dest, "/", d, ".wants/", n);
if (!to)
return log_oom();
@@ -120,7 +120,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
return log_error_errno(errno, "Failed to create symlink %s: %m", to);
free(to);
- to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL);
+ to = strjoin(arg_dest, "/cryptsetup.target.requires/", n);
if (!to)
return log_oom();
@@ -129,7 +129,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
return log_error_errno(errno, "Failed to create symlink %s: %m", to);
free(to);
- to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL);
+ to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n);
if (!to)
return log_oom();
@@ -138,7 +138,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
return log_error_errno(errno, "Failed to create symlink %s: %m", to);
free(p);
- p = strjoin(arg_dest, "/dev-mapper-", e, ".device.d/50-job-timeout-sec-0.conf", NULL);
+ p = strjoin(arg_dest, "/dev-mapper-", e, ".device.d/50-job-timeout-sec-0.conf");
if (!p)
return log_oom();
@@ -194,7 +194,7 @@ static int add_mount(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- p = strjoin(arg_dest, "/", unit, NULL);
+ p = strjoin(arg_dest, "/", unit);
if (!p)
return log_oom();
@@ -236,7 +236,7 @@ static int add_mount(
return log_error_errno(r, "Failed to write unit file %s: %m", p);
if (post) {
- lnk = strjoin(arg_dest, "/", post, ".requires/", unit, NULL);
+ lnk = strjoin(arg_dest, "/", post, ".requires/", unit);
if (!lnk)
return log_oom();
@@ -340,7 +340,7 @@ static int add_swap(const char *path) {
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- unit = strjoin(arg_dest, "/", name, NULL);
+ unit = strjoin(arg_dest, "/", name);
if (!unit)
return log_oom();
@@ -361,7 +361,7 @@ static int add_swap(const char *path) {
if (r < 0)
return log_error_errno(r, "Failed to write unit file %s: %m", unit);
- lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
+ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name);
if (!lnk)
return log_oom();
@@ -393,7 +393,7 @@ static int add_automount(
assert(description);
if (options)
- opt = strjoin(options, ",noauto", NULL);
+ opt = strjoin(options, ",noauto");
else
opt = strdup("noauto");
if (!opt)
@@ -414,7 +414,7 @@ static int add_automount(
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- p = strjoin(arg_dest, "/", unit, NULL);
+ p = strjoin(arg_dest, "/", unit);
if (!p)
return log_oom();
@@ -438,7 +438,7 @@ static int add_automount(
if (r < 0)
return log_error_errno(r, "Failed to write unit file %s: %m", p);
- lnk = strjoin(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/", unit, NULL);
+ lnk = strjoin(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/", unit);
if (!lnk)
return log_oom();
mkdir_parents_label(lnk, 0755);
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index 17e670604e..9f59c04b26 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -56,7 +56,7 @@ static int process_resume(void) {
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- lnk = strjoin(arg_dest, "/" SPECIAL_SYSINIT_TARGET ".wants/", name, NULL);
+ lnk = strjoin(arg_dest, "/" SPECIAL_SYSINIT_TARGET ".wants/", name);
if (!lnk)
return log_oom();
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 197f905b7d..74256e4444 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -335,7 +335,7 @@ static int context_write_data_machine_info(Context *c) {
continue;
}
- t = strjoin(name[p], "=", c->data[p], NULL);
+ t = strjoin(name[p], "=", c->data[p]);
if (!t)
return -ENOMEM;
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
index ab1feb435b..1d16d9f8aa 100644
--- a/src/hwdb/hwdb.c
+++ b/src/hwdb/hwdb.c
@@ -669,7 +669,7 @@ static int hwdb_update(int argc, char *argv[], void *userdata) {
log_debug("strings dedup'ed: %8zu bytes (%8zu)",
trie->strings->dedup_len, trie->strings->dedup_count);
- hwdb_bin = strjoin(arg_root, "/", arg_hwdb_bin_dir, "/hwdb.bin", NULL);
+ hwdb_bin = strjoin(arg_root, "/", arg_hwdb_bin_dir, "/hwdb.bin");
if (!hwdb_bin)
return -ENOMEM;
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 29f3f896e5..808eae38f8 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -267,7 +267,7 @@ static int raw_import_open_disk(RawImport *i) {
assert(!i->temp_path);
assert(i->output_fd < 0);
- i->final_path = strjoin(i->image_root, "/", i->local, ".raw", NULL);
+ i->final_path = strjoin(i->image_root, "/", i->local, ".raw");
if (!i->final_path)
return log_oom();
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index 22f9b8c5ea..1c229ec82f 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -222,7 +222,7 @@ static int tar_import_fork_tar(TarImport *i) {
assert(!i->temp_path);
assert(i->tar_fd < 0);
- i->final_path = strjoin(i->image_root, "/", i->local, NULL);
+ i->final_path = strjoin(i->image_root, "/", i->local);
if (!i->final_path)
return log_oom();
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index 7325adee8f..f75a6f06d2 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -434,7 +434,7 @@ static int request_parse_arguments_iterator(
return MHD_YES;
}
- p = strjoin(key, "=", strempty(value), NULL);
+ p = strjoin(key, "=", strempty(value));
if (!p) {
m->argument_parse_error = log_oom();
return MHD_NO;
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index 61190ff83c..42880cca76 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -438,7 +438,7 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file)
}
if (strchr(host, ':'))
- u->url = strjoin(proto, url, "/upload", NULL);
+ u->url = strjoin(proto, url, "/upload");
else {
char *t;
size_t x;
@@ -448,7 +448,7 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file)
while (x > 0 && t[x - 1] == '/')
t[x - 1] = '\0';
- u->url = strjoin(proto, t, ":" STRINGIFY(DEFAULT_PORT), "/upload", NULL);
+ u->url = strjoin(proto, t, ":" STRINGIFY(DEFAULT_PORT), "/upload");
}
if (!u->url)
return log_oom();
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 7f997487b4..22cab67824 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -192,7 +192,7 @@ static int add_matches_for_device(sd_journal *j, const char *devpath) {
continue;
}
- match = strjoin("_KERNEL_DEVICE=+", subsys, ":", sysname, NULL);
+ match = strjoin("_KERNEL_DEVICE=+", subsys, ":", sysname);
if (!match)
return log_oom();
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 908c7b8eeb..dee153a4cf 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -731,7 +731,7 @@ static int get_invocation_id(const char *cgroup_root, const char *slice, const c
if (!escaped)
return -ENOMEM;
- p = strjoin(cgroup_root, "/", slice_path, "/", escaped, NULL);
+ p = strjoin(cgroup_root, "/", slice_path, "/", escaped);
if (!p)
return -ENOMEM;
@@ -2051,8 +2051,8 @@ int server_init(Server *s) {
s->runtime_storage.name = "Runtime journal";
s->system_storage.name = "System journal";
- s->runtime_storage.path = strjoin("/run/log/journal/", SERVER_MACHINE_ID(s), NULL);
- s->system_storage.path = strjoin("/var/log/journal/", SERVER_MACHINE_ID(s), NULL);
+ s->runtime_storage.path = strjoin("/run/log/journal/", SERVER_MACHINE_ID(s));
+ s->system_storage.path = strjoin("/var/log/journal/", SERVER_MACHINE_ID(s));
if (!s->runtime_storage.path || !s->system_storage.path)
return -ENOMEM;
diff --git a/src/journal/journald-wall.c b/src/journal/journald-wall.c
index 4d91fafffe..d857ff8d39 100644
--- a/src/journal/journald-wall.c
+++ b/src/journal/journald-wall.c
@@ -57,7 +57,7 @@ void server_forward_wall(
} else if (identifier) {
- l = l_buf = strjoin(identifier, ": ", message, NULL);
+ l = l_buf = strjoin(identifier, ": ", message);
if (!l_buf) {
log_oom();
return;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index f2f8546086..47c77b1ba9 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -405,7 +405,7 @@ static char *match_make_string(Match *m) {
return mfree(p);
if (p) {
- k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
+ k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t);
free(p);
free(t);
@@ -420,7 +420,7 @@ static char *match_make_string(Match *m) {
}
if (enclose) {
- r = strjoin("(", p, ")", NULL);
+ r = strjoin("(", p, ")");
free(p);
return r;
}
@@ -1416,7 +1416,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
* and reenumerates directory contents */
if (dirname)
- path = strjoin(prefix, "/", dirname, NULL);
+ path = strjoin(prefix, "/", dirname);
else
path = strdup(prefix);
if (!path) {
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 59398b841d..a3427ca33e 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1649,7 +1649,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
if (s) {
char *p;
- p = strjoin("/sys/fs/kdbus/", n->str, "/bus", NULL);
+ p = strjoin("/sys/fs/kdbus/", n->str, "/bus");
if (!p) {
safe_close(fd);
return -ENOMEM;
diff --git a/src/libsystemd/sd-bus/busctl-introspect.c b/src/libsystemd/sd-bus/busctl-introspect.c
index b09509f8e1..09cbd9ab44 100644
--- a/src/libsystemd/sd-bus/busctl-introspect.c
+++ b/src/libsystemd/sd-bus/busctl-introspect.c
@@ -285,7 +285,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
if (endswith(prefix, "/"))
node_path = strappend(prefix, name);
else
- node_path = strjoin(prefix, "/", name, NULL);
+ node_path = strjoin(prefix, "/", name);
if (!node_path)
return log_oom();
}
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 2c3f591053..9dd3828364 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1102,7 +1102,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
return -EINVAL;
}
- m = strjoin("sender='", *i, "'", NULL);
+ m = strjoin("sender='", *i, "'");
if (!m)
return log_oom();
@@ -1111,7 +1111,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
return bus_log_create_error(r);
free(m);
- m = strjoin("destination='", *i, "'", NULL);
+ m = strjoin("destination='", *i, "'");
if (!m)
return log_oom();
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index d746348544..e809942278 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1339,7 +1339,7 @@ int bus_set_address_system_remote(sd_bus *b, const char *host) {
return -ENOMEM;
}
- b->address = strjoin("unixexec:path=ssh,argv1=-xT,argv2=", e, ",argv3=systemd-stdio-bridge", c, NULL);
+ b->address = strjoin("unixexec:path=ssh,argv1=-xT,argv2=", e, ",argv3=systemd-stdio-bridge", c);
if (!b->address)
return -ENOMEM;
@@ -1387,7 +1387,7 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine) {
if (!e)
return -ENOMEM;
- b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
+ b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e);
if (!b->address)
return -ENOMEM;
@@ -3470,7 +3470,7 @@ _public_ int sd_bus_path_encode(const char *prefix, const char *external_id, cha
if (!e)
return -ENOMEM;
- ret = strjoin(prefix, "/", e, NULL);
+ ret = strjoin(prefix, "/", e);
if (!ret)
return -ENOMEM;
diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c
index f11cafd888..233a21a523 100644
--- a/src/libsystemd/sd-bus/test-bus-objects.c
+++ b/src/libsystemd/sd-bus/test-bus-objects.c
@@ -49,7 +49,7 @@ static int something_handler(sd_bus_message *m, void *userdata, sd_bus_error *er
r = sd_bus_message_read(m, "s", &s);
assert_se(r > 0);
- n = strjoin("<<<", s, ">>>", NULL);
+ n = strjoin("<<<", s, ">>>");
assert_se(n);
free(c->something);
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 62d03ae00d..86f8935a14 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -773,7 +773,7 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
if (dent->d_type != DT_DIR)
continue;
- child = strjoin(path, "/", dent->d_name, NULL);
+ child = strjoin(path, "/", dent->d_name);
if (!child)
return -ENOMEM;
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index b7aec1f20a..752c1ba56b 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -77,7 +77,7 @@ static int from_home_dir(const char *envname, const char *suffix, char **buffer,
if (endswith(h, "/"))
cc = strappend(h, suffix);
else
- cc = strjoin(h, "/", suffix, NULL);
+ cc = strjoin(h, "/", suffix);
if (!cc)
return -ENOMEM;
@@ -387,7 +387,7 @@ _public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
if (endswith(ret, "/"))
cc = strappend(ret, suffix);
else
- cc = strjoin(ret, "/", suffix, NULL);
+ cc = strjoin(ret, "/", suffix);
free(buffer);
@@ -455,7 +455,7 @@ static int search_from_environment(
if (endswith(e, "/"))
h = strappend(e, home_suffix);
else
- h = strjoin(e, "/", home_suffix, NULL);
+ h = strjoin(e, "/", home_suffix);
if (!h) {
strv_free(l);
@@ -621,7 +621,7 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
if (endswith(*i, "/"))
*j = strappend(*i, suffix);
else
- *j = strjoin(*i, "/", suffix, NULL);
+ *j = strjoin(*i, "/", suffix);
if (!*j) {
strv_free(l);
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index a6bcd1ad54..da72bee4a9 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -519,7 +519,7 @@ int find_converted_keymap(const char *x11_layout, const char *x11_variant, char
_cleanup_free_ char *n;
if (x11_variant)
- n = strjoin(x11_layout, "-", x11_variant, NULL);
+ n = strjoin(x11_layout, "-", x11_variant);
else
n = strdup(x11_layout);
if (!n)
@@ -529,8 +529,8 @@ int find_converted_keymap(const char *x11_layout, const char *x11_variant, char
_cleanup_free_ char *p = NULL, *pz = NULL;
bool uncompressed;
- p = strjoin(dir, "xkb/", n, ".map", NULL);
- pz = strjoin(dir, "xkb/", n, ".map.gz", NULL);
+ p = strjoin(dir, "xkb/", n, ".map");
+ pz = strjoin(dir, "xkb/", n, ".map.gz");
if (!p || !pz)
return -ENOMEM;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index c93b24009b..a7e5c01ef3 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -294,7 +294,7 @@ int inhibitor_create_fifo(Inhibitor *i) {
if (r < 0)
return r;
- i->fifo_path = strjoin("/run/systemd/inhibit/", i->id, ".ref", NULL);
+ i->fifo_path = strjoin("/run/systemd/inhibit/", i->id, ".ref");
if (!i->fifo_path)
return -ENOMEM;
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index cbf035f706..e83c37a5ac 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -505,7 +505,7 @@ static int session_start_scope(Session *s) {
char *scope, *job = NULL;
const char *description;
- scope = strjoin("session-", s->id, ".scope", NULL);
+ scope = strjoin("session-", s->id, ".scope");
if (!scope)
return log_oom();
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index 4f023640f6..b0f75b2a21 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -186,7 +186,7 @@ static int export_legacy_dbus_address(
* daemons that spawn dbus-daemon, instead of forcing
* DBUS_SESSION_BUS_ADDRESS= here. */
- s = strjoin(runtime, "/bus", NULL);
+ s = strjoin(runtime, "/bus");
if (!s)
goto error;
diff --git a/src/machine/machine.c b/src/machine/machine.c
index a02b9d7575..9e7b6cc03d 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -355,7 +355,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er
if (!escaped)
return log_oom();
- scope = strjoin("machine-", escaped, ".scope", NULL);
+ scope = strjoin("machine-", escaped, ".scope");
if (!scope)
return log_oom();
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 80bba086e4..9d79e81918 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -697,7 +697,7 @@ static int acquire_mount_where(struct udev_device *d) {
if (!filename_is_valid(escaped))
return 0;
- arg_mount_where = strjoin("/run/media/system/", escaped, NULL);
+ arg_mount_where = strjoin("/run/media/system/", escaped);
} else
arg_mount_where = strdup(v);
@@ -721,7 +721,7 @@ static int acquire_description(struct udev_device *d) {
label = udev_device_get_property_value(d, "ID_PART_ENTRY_NUMBER");
if (model && label)
- arg_description = strjoin(model, " ", label, NULL);
+ arg_description = strjoin(model, " ", label);
else if (label)
arg_description = strdup(label);
else if (model)
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 115de64cf9..392498d1bb 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -193,11 +193,9 @@ static int tmpfs_patch_options(
if ((userns && uid_shift != 0) || patch_ids) {
assert(uid_shift != UID_INVALID);
- if (options)
- (void) asprintf(&buf, "%s,uid=" UID_FMT ",gid=" UID_FMT, options, uid_shift, uid_shift);
- else
- (void) asprintf(&buf, "uid=" UID_FMT ",gid=" UID_FMT, uid_shift, uid_shift);
- if (!buf)
+ if (asprintf(&buf, "%s%suid=" UID_FMT ",gid=" UID_FMT,
+ options ?: "", options ? "," : "",
+ uid_shift, uid_shift) < 0)
return -ENOMEM;
options = buf;
@@ -207,16 +205,12 @@ static int tmpfs_patch_options(
if (selinux_apifs_context) {
char *t;
- if (options)
- t = strjoin(options, ",context=\"", selinux_apifs_context, "\"", NULL);
- else
- t = strjoin("context=\"", selinux_apifs_context, "\"", NULL);
- if (!t) {
- free(buf);
+ t = strjoin(options ?: "", options ? "," : "",
+ "context=\"", selinux_apifs_context, "\"");
+ free(buf);
+ if (!t)
return -ENOMEM;
- }
- free(buf);
buf = t;
}
#endif
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index c56af6e6f4..673e616911 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2547,7 +2547,7 @@ static int determine_names(void) {
* search for a machine, but instead create a new one
* in /var/lib/machine. */
- arg_directory = strjoin("/var/lib/machines/", arg_machine, NULL);
+ arg_directory = strjoin("/var/lib/machines/", arg_machine);
if (!arg_directory)
return log_oom();
}
@@ -3390,7 +3390,7 @@ static int load_settings(void) {
FOREACH_STRING(i, "/etc/systemd/nspawn", "/run/systemd/nspawn") {
_cleanup_free_ char *j = NULL;
- j = strjoin(i, "/", fn, NULL);
+ j = strjoin(i, "/", fn);
if (!j)
return log_oom();
diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c
index 17d04e958d..c80972742b 100644
--- a/src/nss-systemd/nss-systemd.c
+++ b/src/nss-systemd/nss-systemd.c
@@ -33,14 +33,6 @@
#include "user-util.h"
#include "util.h"
-#ifndef NOBODY_USER_NAME
-#define NOBODY_USER_NAME "nobody"
-#endif
-
-#ifndef NOBODY_GROUP_NAME
-#define NOBODY_GROUP_NAME "nobody"
-#endif
-
static const struct passwd root_passwd = {
.pw_name = (char*) "root",
.pw_passwd = (char*) "x", /* see shadow file */
diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c
index 618bbe428d..b704ca3b4b 100644
--- a/src/rc-local-generator/rc-local-generator.c
+++ b/src/rc-local-generator/rc-local-generator.c
@@ -45,11 +45,11 @@ static int add_symlink(const char *service, const char *where) {
assert(service);
assert(where);
- from = strjoin(SYSTEM_DATA_UNIT_PATH, "/", service, NULL);
+ from = strjoin(SYSTEM_DATA_UNIT_PATH, "/", service);
if (!from)
return log_oom();
- to = strjoin(arg_dest, "/", where, ".wants/", service, NULL);
+ to = strjoin(arg_dest, "/", where, ".wants/", service);
if (!to)
return log_oom();
diff --git a/src/resolve/resolved-dns-dnssec.c b/src/resolve/resolved-dns-dnssec.c
index d4a267c89f..51327105d0 100644
--- a/src/resolve/resolved-dns-dnssec.c
+++ b/src/resolve/resolved-dns-dnssec.c
@@ -1303,7 +1303,7 @@ static int nsec3_hashed_domain_format(const uint8_t *hashed, size_t hashed_size,
if (!l)
return -ENOMEM;
- j = strjoin(l, ".", zone, NULL);
+ j = strjoin(l, ".", zone);
if (!j)
return -ENOMEM;
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c
index 87e4abec6e..209d565033 100644
--- a/src/resolve/resolved-dns-rr.c
+++ b/src/resolve/resolved-dns-rr.c
@@ -792,7 +792,7 @@ static char *format_types(Bitmap *types) {
if (!str)
return NULL;
- return strjoin("( ", str, " )", NULL);
+ return strjoin("( ", str, " )");
}
static char *format_txt(DnsTxtItem *first) {
@@ -861,14 +861,14 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_DNAME:
- s = strjoin(k, " ", rr->ptr.name, NULL);
+ s = strjoin(k, " ", rr->ptr.name);
if (!s)
return NULL;
break;
case DNS_TYPE_HINFO:
- s = strjoin(k, " ", rr->hinfo.cpu, " ", rr->hinfo.os, NULL);
+ s = strjoin(k, " ", rr->hinfo.cpu, " ", rr->hinfo.os);
if (!s)
return NULL;
break;
@@ -879,7 +879,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (!t)
return NULL;
- s = strjoin(k, " ", t, NULL);
+ s = strjoin(k, " ", t);
if (!s)
return NULL;
break;
@@ -891,7 +891,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (r < 0)
return NULL;
- s = strjoin(k, " ", x, NULL);
+ s = strjoin(k, " ", x);
if (!s)
return NULL;
break;
@@ -902,7 +902,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (r < 0)
return NULL;
- s = strjoin(k, " ", t, NULL);
+ s = strjoin(k, " ", t);
if (!s)
return NULL;
break;
@@ -942,7 +942,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (!t)
return NULL;
- s = strjoin(k, " ", t, NULL);
+ s = strjoin(k, " ", t);
if (!s)
return NULL;
break;
diff --git a/src/resolve/test-dnssec-complex.c b/src/resolve/test-dnssec-complex.c
index 58c089eb40..3d7074af11 100644
--- a/src/resolve/test-dnssec-complex.c
+++ b/src/resolve/test-dnssec-complex.c
@@ -42,7 +42,7 @@ static void prefix_random(const char *name, char **ret) {
char *x;
assert_se(asprintf(&b, "x%" PRIu64 "x", random_u64()));
- x = strjoin(b, ".", name, NULL);
+ x = strjoin(b, ".", name);
assert_se(x);
free(m);
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 0acdf229ed..c0f138b4f4 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -184,9 +184,9 @@ static int determine_state_file(
if (!escaped_path_id)
return log_oom();
- state_file = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", type, NULL);
+ state_file = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", type);
} else
- state_file = strjoin("/var/lib/systemd/rfkill/", type, NULL);
+ state_file = strjoin("/var/lib/systemd/rfkill/", type);
if (!state_file)
return log_oom();
diff --git a/src/run/run.c b/src/run/run.c
index 81b53fdfab..8f1cc9e2e3 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -747,7 +747,7 @@ static int make_unit_name(sd_bus *bus, UnitType t, char **ret) {
return -EINVAL;
}
- p = strjoin("run-u", id, ".", unit_type_to_string(t), NULL);
+ p = strjoin("run-u", id, ".", unit_type_to_string(t));
if (!p)
return log_oom();
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 59a34a9d11..f1fbce9dca 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -82,7 +82,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
if (table[i].exists) {
_cleanup_free_ char *p = NULL;
- p = strjoin(s, "/", table[i].exists, NULL);
+ p = strjoin(s, "/", table[i].exists);
if (!p)
return log_oom();
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index bb90c89cc2..3b8768b9a7 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -676,7 +676,7 @@ int bus_connect_user_systemd(sd_bus **_bus) {
if (r < 0)
return r;
- bus->address = strjoin("unix:path=", ee, "/systemd/private", NULL);
+ bus->address = strjoin("unix:path=", ee, "/systemd/private");
if (!bus->address)
return -ENOMEM;
@@ -1460,7 +1460,7 @@ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id,
if (!external_label)
return -ENOMEM;
- p = strjoin(prefix, "/", sender_label, "/", external_label, NULL);
+ p = strjoin(prefix, "/", sender_label, "/", external_label);
if (!p)
return -ENOMEM;
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 3e451db715..4db6cefb6e 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -158,7 +158,7 @@ int show_cgroup_by_path(
while ((r = cg_read_subgroup(d, &gn)) > 0) {
_cleanup_free_ char *k = NULL;
- k = strjoin(fn, "/", gn, NULL);
+ k = strjoin(fn, "/", gn);
free(gn);
if (!k)
return -ENOMEM;
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 2ec0155b71..19a371c865 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -101,7 +101,7 @@ int config_item_perf_lookup(
else {
char *key;
- key = strjoin(section, ".", lvalue, NULL);
+ key = strjoin(section, ".", lvalue);
if (!key)
return -ENOMEM;
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 892f0aadf5..f9a6fd5f03 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -1076,7 +1076,7 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do
if (!name)
return -ENOMEM;
- type = strjoin(b, ".", c, NULL);
+ type = strjoin(b, ".", c);
if (!type)
return -ENOMEM;
@@ -1090,7 +1090,7 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do
name = NULL;
- type = strjoin(a, ".", b, NULL);
+ type = strjoin(a, ".", b);
if (!type)
return -ENOMEM;
diff --git a/src/shared/dropin.c b/src/shared/dropin.c
index b9cd952ac8..2c1cd84df5 100644
--- a/src/shared/dropin.c
+++ b/src/shared/dropin.c
@@ -61,11 +61,11 @@ int drop_in_file(const char *dir, const char *unit, unsigned level,
if (!filename_is_valid(b))
return -EINVAL;
- p = strjoin(dir, "/", unit, ".d", NULL);
+ p = strjoin(dir, "/", unit, ".d");
if (!p)
return -ENOMEM;
- q = strjoin(p, "/", prefix, "-", b, ".conf", NULL);
+ q = strjoin(p, "/", prefix, "-", b, ".conf");
if (!q) {
free(p);
return -ENOMEM;
@@ -163,7 +163,7 @@ static int iterate_dir(
if (hidden_or_backup_file(de->d_name))
continue;
- f = strjoin(path, "/", de->d_name, NULL);
+ f = strjoin(path, "/", de->d_name);
if (!f)
return log_oom();
@@ -192,7 +192,7 @@ int unit_file_process_dir(
assert(name);
assert(suffix);
- path = strjoin(unit_path, "/", name, suffix, NULL);
+ path = strjoin(unit_path, "/", name, suffix);
if (!path)
return log_oom();
@@ -207,7 +207,7 @@ int unit_file_process_dir(
if (r < 0)
return log_error_errno(r, "Failed to generate template from unit name: %m");
- p = strjoin(unit_path, "/", template, suffix, NULL);
+ p = strjoin(unit_path, "/", template, suffix);
if (!p)
return log_oom();
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
index a4e0cd3267..f0bfb30bb5 100644
--- a/src/shared/fstab-util.c
+++ b/src/shared/fstab-util.c
@@ -241,7 +241,7 @@ static char *tag_to_udev_node(const char *tagvalue, const char *by) {
if (encode_devnode_name(u, t, enc_len) < 0)
return NULL;
- return strjoin("/dev/disk/by-", by, "/", t, NULL);
+ return strjoin("/dev/disk/by-", by, "/", t);
}
char *fstab_node_to_udev_node(const char *p) {
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index cbdf66827f..007c632f35 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -45,7 +45,7 @@ static int specifier_prefix_and_instance(char specifier, void *data, void *userd
if (endswith(prefix, "@") && i->default_instance) {
char *ans;
- ans = strjoin(prefix, i->default_instance, NULL);
+ ans = strjoin(prefix, i->default_instance);
if (!ans)
return -ENOMEM;
*ret = ans;
diff --git a/src/shared/install.c b/src/shared/install.c
index 96fba6e25b..474426d927 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1307,7 +1307,7 @@ static int unit_file_search(
STRV_FOREACH(p, paths->search_path) {
_cleanup_free_ char *path = NULL;
- path = strjoin(*p, "/", info->name, NULL);
+ path = strjoin(*p, "/", info->name);
if (!path)
return -ENOMEM;
@@ -1332,7 +1332,7 @@ static int unit_file_search(
STRV_FOREACH(p, paths->search_path) {
_cleanup_free_ char *path = NULL;
- path = strjoin(*p, "/", template, NULL);
+ path = strjoin(*p, "/", template);
if (!path)
return -ENOMEM;
@@ -1612,7 +1612,7 @@ static int install_info_symlink_wants(
continue;
}
- path = strjoin(config_path, "/", dst, suffix, n, NULL);
+ path = strjoin(config_path, "/", dst, suffix, n);
if (!path)
return -ENOMEM;
@@ -1646,7 +1646,7 @@ static int install_info_symlink_link(
if (r > 0)
return 0;
- path = strjoin(config_path, "/", i->name, NULL);
+ path = strjoin(config_path, "/", i->name);
if (!path)
return -ENOMEM;
@@ -2166,7 +2166,7 @@ int unit_file_revert(
STRV_FOREACH(j, fs) {
_cleanup_free_ char *t = NULL;
- t = strjoin(*i, "/", *j, NULL);
+ t = strjoin(*i, "/", *j);
if (!t)
return -ENOMEM;
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 060f8d50c7..6414ba5246 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -131,7 +131,7 @@ static int image_new(
return -ENOMEM;
if (path)
- i->path = strjoin(path, "/", filename, NULL);
+ i->path = strjoin(path, "/", filename);
else
i->path = strdup(filename);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 862096ae7b..a23d09967e 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -70,7 +70,7 @@ static int user_config_dir(char **ret, const char *suffix) {
if (!home)
return -ENXIO;
- j = strjoin(home, "/.config", suffix, NULL);
+ j = strjoin(home, "/.config", suffix);
}
if (!j)
@@ -102,7 +102,7 @@ static int user_data_dir(char **ret, const char *suffix) {
return -ENXIO;
- j = strjoin(home, "/.local/share", suffix, NULL);
+ j = strjoin(home, "/.local/share", suffix);
}
if (!j)
return -ENOMEM;
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index dd3b931cd6..9e723b0261 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -527,7 +527,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
}
if (u->machine) {
- j = strjoin(u->machine, ":", u->id, NULL);
+ j = strjoin(u->machine, ":", u->id);
if (!j)
return log_oom();
@@ -939,7 +939,7 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
char **a;
if (s->machine) {
- j = strjoin(s->machine, ":", s->path, NULL);
+ j = strjoin(s->machine, ":", s->path);
if (!j)
return log_oom();
path = j;
@@ -1223,7 +1223,7 @@ static int output_timers_list(struct timer_info *timer_infos, unsigned n) {
format_timestamp_relative(trel2, sizeof(trel2), t->last_trigger);
if (t->machine) {
- j = strjoin(t->machine, ":", t->id, NULL);
+ j = strjoin(t->machine, ":", t->id);
if (!j)
return log_oom();
unit = j;
@@ -6519,12 +6519,12 @@ static int get_file_to_edit(
assert(name);
assert(ret_path);
- path = strjoin(paths->persistent_config, "/", name, NULL);
+ path = strjoin(paths->persistent_config, "/", name);
if (!path)
return log_oom();
if (arg_runtime) {
- run = strjoin(paths->runtime_config, "/", name, NULL);
+ run = strjoin(paths->runtime_config, "/", name);
if (!run)
return log_oom();
}
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index c2c80175a2..921fd478d0 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -562,7 +562,7 @@ static int load_sysv(SysvStub *s) {
char *d = NULL;
if (chkconfig_description)
- d = strjoin(chkconfig_description, " ", j, NULL);
+ d = strjoin(chkconfig_description, " ", j);
else
d = strdup(j);
if (!d)
@@ -624,7 +624,7 @@ static int load_sysv(SysvStub *s) {
char *d = NULL;
if (long_description)
- d = strjoin(long_description, " ", t, NULL);
+ d = strjoin(long_description, " ", t);
else
d = strdup(j);
if (!d)
@@ -803,7 +803,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
continue;
}
- fpath = strjoin(*path, "/", de->d_name, NULL);
+ fpath = strjoin(*path, "/", de->d_name);
if (!fpath)
return log_oom();
@@ -849,7 +849,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
_cleanup_free_ char *path = NULL;
struct dirent *de;
- path = strjoin(*p, "/", rcnd_table[i].path, NULL);
+ path = strjoin(*p, "/", rcnd_table[i].path);
if (!path) {
r = log_oom();
goto finish;
@@ -879,7 +879,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
if (a < 0 || b < 0)
continue;
- fpath = strjoin(*p, "/", de->d_name, NULL);
+ fpath = strjoin(*p, "/", de->d_name);
if (!fpath) {
r = log_oom();
goto finish;
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index ed1ea51dbd..91d2a0bcd4 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -106,7 +106,7 @@ static void test_copy_tree(void) {
STRV_FOREACH(p, files) {
_cleanup_free_ char *f;
- assert_se(f = strappend(original_dir, *p));
+ assert_se((f = strappend(original_dir, *p)));
assert_se(mkdir_parents(f, 0755) >= 0);
assert_se(write_string_file(f, "file", WRITE_STRING_FILE_CREATE) == 0);
@@ -115,8 +115,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *f, *l;
- assert_se(f = strappend(original_dir, *p));
- assert_se(l = strappend(original_dir, *link));
+ assert_se((f = strappend(original_dir, *p)));
+ assert_se((l = strappend(original_dir, *link)));
assert_se(mkdir_parents(l, 0755) >= 0);
assert_se(symlink(f, l) == 0);
@@ -131,7 +131,7 @@ static void test_copy_tree(void) {
_cleanup_free_ char *buf = NULL, *f;
size_t sz = 0;
- assert_se(f = strappend(copy_dir, *p));
+ assert_se((f = strappend(copy_dir, *p)));
assert_se(access(f, F_OK) == 0);
assert_se(read_full_file(f, &buf, &sz) == 0);
@@ -141,8 +141,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *target = NULL, *f, *l;
- assert_se(f = strjoin(original_dir, *p, NULL));
- assert_se(l = strjoin(copy_dir, *link, NULL));
+ assert_se((f = strjoin(original_dir, *p)));
+ assert_se((l = strjoin(copy_dir, *link)));
assert_se(readlink_and_canonicalize(l, &target) == 0);
assert_se(path_equal(f, target));
diff --git a/src/test/test-date.c b/src/test/test-date.c
index 7f497bb7d5..a8d3f1e083 100644
--- a/src/test/test-date.c
+++ b/src/test/test-date.c
@@ -60,7 +60,7 @@ static void test_one(const char *p) {
_cleanup_free_ char *with_utc;
log_info("Test: %s", p);
- with_utc = strjoin(p, " UTC", NULL);
+ with_utc = strjoin(p, " UTC");
test_should_pass(p);
test_should_pass(with_utc);
}
@@ -69,7 +69,7 @@ static void test_one_noutc(const char *p) {
_cleanup_free_ char *with_utc;
log_info("Test: %s", p);
- with_utc = strjoin(p, " UTC", NULL);
+ with_utc = strjoin(p, " UTC");
test_should_pass(p);
test_should_fail(with_utc);
}
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 92663ef66f..56316904a3 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -367,7 +367,7 @@ static void test_write_string_file_verify(void) {
int r;
assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
- assert_se((buf2 = strjoin(buf, "\n", NULL)));
+ assert_se((buf2 = strjoin(buf, "\n")));
r = write_string_file("/proc/cmdline", buf, 0);
assert_se(r == -EACCES || r == -EIO);
diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c
index ff9f35cecd..de7be1f9cc 100644
--- a/src/test/test-namespace.c
+++ b/src/test/test-namespace.c
@@ -132,14 +132,14 @@ int main(int argc, char *argv[]) {
assert_se(sd_id128_get_boot(&bid) >= 0);
sd_id128_to_string(bid, boot_id);
- x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
- y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
+ x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-");
+ y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-");
assert_se(x && y);
test_tmpdir("abcd.service", x, y);
- z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
- zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
+ z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
+ zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
assert_se(z && zz);
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 4d3f0e9948..5e99d478ee 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -56,7 +56,7 @@ static int setup_test(Manager **m) {
STRV_FOREACH(test_path, tests_path) {
_cleanup_free_ char *p = NULL;
- p = strjoin("/tmp/test-path_", *test_path, NULL);
+ p = strjoin("/tmp/test-path_", *test_path);
assert_se(p);
(void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
diff --git a/src/test/test-replace-var.c b/src/test/test-replace-var.c
index 297effce79..60e05d04c9 100644
--- a/src/test/test-replace-var.c
+++ b/src/test/test-replace-var.c
@@ -25,7 +25,7 @@
#include "util.h"
static char *lookup(const char *variable, void *userdata) {
- return strjoin("<<<", variable, ">>>", NULL);
+ return strjoin("<<<", variable, ">>>");
}
int main(int argc, char *argv[]) {
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 954f4aa985..97a564d5a2 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -422,7 +422,7 @@ static int dir_cleanup(
continue;
}
- sub_path = strjoin(p, "/", dent->d_name, NULL);
+ sub_path = strjoin(p, "/", dent->d_name);
if (!sub_path) {
r = log_oom();
goto finish;
@@ -1082,7 +1082,7 @@ static int item_do_children(Item *i, const char *path, action_t action) {
if (STR_IN_SET(de->d_name, ".", ".."))
continue;
- p = strjoin(path, "/", de->d_name, NULL);
+ p = strjoin(path, "/", de->d_name);
if (!p)
return -ENOMEM;
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index f4a065a97d..acd1d1a6de 100644
--- a/src/udev/udev-builtin-hwdb.c
+++ b/src/udev/udev-builtin-hwdb.c
@@ -43,7 +43,7 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev,
return -ENOENT;
if (prefix) {
- lookup = strjoin(prefix, modalias, NULL);
+ lookup = strjoin(prefix, modalias);
if (!lookup)
return -ENOMEM;
modalias = lookup;
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 1bffe8e8ab..70a5fa4d7a 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -653,7 +653,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
log_debug("strings dedup'ed: %8zu bytes (%8zu)",
trie->strings->dedup_len, trie->strings->dedup_count);
- hwdb_bin = strjoin(root, "/", hwdb_bin_dir, "/hwdb.bin", NULL);
+ hwdb_bin = strjoin(root, "/", hwdb_bin_dir, "/hwdb.bin");
if (!hwdb_bin) {
rc = EXIT_FAILURE;
goto out;