diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-23 11:43:27 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-23 11:43:27 -0400 |
commit | 605405c6cc934466951b0c6bad5a9553620bcb08 (patch) | |
tree | af4eb757a0508374d581f746e3ce6a3ca5606dbb /src | |
parent | 3c5d7c978c5f5e6fcc1d3175bb22dd1b3477f4b4 (diff) |
tree-wide: drop NULL sentinel from strjoin
This makes strjoin and strjoina more similar and avoids the useless final
argument.
spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c)
git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/'
This might have missed a few cases (spatch has a really hard time dealing
with _cleanup_ macros), but that's no big issue, they can always be fixed
later.
Diffstat (limited to 'src')
88 files changed, 199 insertions, 194 deletions
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 0ef00676ef..b221309a4d 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -641,7 +641,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 0f5b20cf05..e438f27df5 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; @@ -444,13 +444,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) { @@ -494,7 +492,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 09bbe038e9..bd6248406f 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -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 245912fc0f..6948daf682 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -484,7 +484,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) @@ -986,7 +986,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; @@ -1365,7 +1365,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 8a3e888e5e..bb10148223 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 1b7b4a928d..23a702e93e 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1630,7 +1630,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; @@ -1737,7 +1737,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)) @@ -1951,7 +1951,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; @@ -2027,7 +2027,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; @@ -3006,7 +3006,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 0549f5ef1b..fa02389167 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; 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 53c26984ca..5a9b01dadb 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3260,7 +3260,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 2fa397bd41..14e1d7d20d 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2469,7 +2469,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) @@ -3629,7 +3629,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/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 be4ef5f9e9..42e68e676a 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 76c9baf6db..1ed223636c 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -733,7 +733,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; @@ -2053,8 +2053,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 44dc9bfcf4..9a03f4b0bd 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -208,9 +208,9 @@ static int tmpfs_patch_options( char *t; if (options) - t = strjoin(options, ",context=\"", selinux_apifs_context, "\"", NULL); + t = strjoin(options, ",context=\"", selinux_apifs_context, "\""); else - t = strjoin("context=\"", selinux_apifs_context, "\"", NULL); + t = strjoin("context=\"", selinux_apifs_context, "\""); if (!t) { free(buf); return -ENOMEM; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 2cbe563953..e013417cb4 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -2537,7 +2537,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(); } @@ -3380,7 +3380,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/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 d33a658d0a..21cb57bc5a 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1303,7 +1303,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; @@ -1328,7 +1328,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; @@ -1608,7 +1608,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; @@ -1642,7 +1642,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; @@ -2162,7 +2162,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 129706d15f..2f20a250c2 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -518,7 +518,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(); @@ -929,7 +929,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; @@ -1213,7 +1213,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; @@ -6418,12 +6418,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..91e4e5b409 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -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; |