From b7def684941808600c344f0be7a2b9fcdda97e0f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 13 Jul 2012 13:41:01 +0200 Subject: util: rename join() to strjoin() This is to match strappend() and the other string related functions. --- src/cgtop/cgtop.c | 2 +- src/core/cgroup.c | 4 ++-- src/core/dbus-manager.c | 2 +- src/core/load-dropin.c | 6 +++--- src/core/manager.c | 4 ++-- src/core/mount.c | 2 +- src/core/service.c | 14 +++++++------- src/core/unit.c | 4 ++-- src/cryptsetup/cryptsetup-generator.c | 10 +++++----- src/delta/delta.c | 4 ++-- src/fstab-generator/fstab-generator.c | 16 ++++++++-------- src/getty-generator/getty-generator.c | 2 +- src/journal/coredump.c | 4 ++-- src/journal/journald.c | 4 ++-- src/journal/sd-journal.c | 10 +++++----- src/shared/cgroup-util.c | 10 +++++----- src/shared/conf-parser.c | 2 +- src/shared/hwclock.c | 2 +- src/shared/path-util.c | 2 +- src/shared/unit-name.c | 4 ++-- src/shared/util.c | 4 ++-- src/shared/util.h | 2 +- src/tmpfiles/tmpfiles.c | 2 +- 23 files changed, 58 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index f988adb363..5557094a4f 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -310,7 +310,7 @@ static int refresh_one( if (r <= 0) goto finish; - p = join(path, "/", fn, NULL); + p = strjoin(path, "/", fn, NULL); free(fn); if (!p) { diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 5513f6560c..aaea96b820 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -120,7 +120,7 @@ int cgroup_bonding_install(CGroupBonding *b, pid_t pid, const char *cgroup_suffi assert(pid >= 0); if (cgroup_suffix) { - p = join(b->path, "/", cgroup_suffix, NULL); + p = strjoin(b->path, "/", cgroup_suffix, NULL); if (!p) return -ENOMEM; @@ -208,7 +208,7 @@ int cgroup_bonding_kill(CGroupBonding *b, int sig, bool sigcont, bool rem, Set * return 0; if (cgroup_suffix) { - p = join(b->path, "/", cgroup_suffix, NULL); + p = strjoin(b->path, "/", cgroup_suffix, NULL); if (!p) return -ENOMEM; diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index f8a5400055..67b7b13eac 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1179,7 +1179,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, else { char *p; - p = join(switch_root, "/", switch_root_init, NULL); + p = strjoin(switch_root, "/", switch_root_init, NULL); if (!p) goto oom; diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 4323147a01..86f81c7484 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -51,7 +51,7 @@ static int iterate_dir(Unit *u, const char *path, UnitDependency dependency) { if (ignore_file(de->d_name)) continue; - f = join(path, "/", de->d_name, NULL); + f = strjoin(path, "/", de->d_name, NULL); if (!f) { r = -ENOMEM; goto finish; @@ -80,7 +80,7 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c assert(name); assert(suffix); - path = join(unit_path, "/", name, suffix, NULL); + path = strjoin(unit_path, "/", name, suffix, NULL); if (!path) return -ENOMEM; @@ -102,7 +102,7 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c if (!template) return -ENOMEM; - path = join(unit_path, "/", template, suffix, NULL); + path = strjoin(unit_path, "/", template, suffix, NULL); free(template); if (!path) diff --git a/src/core/manager.c b/src/core/manager.c index 7bd484be6c..8f2635051e 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -590,7 +590,7 @@ static void manager_build_unit_path_cache(Manager *m) { if (ignore_file(de->d_name)) continue; - p = join(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL); + p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL); if (!p) { r = -ENOMEM; goto fail; @@ -2085,7 +2085,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name) return r; } } else { - p = join("/tmp/systemd-", name, ".XXXXXX", NULL); + p = strjoin("/tmp/systemd-", name, ".XXXXXX", NULL); if (!p) { log_error("Out of memory"); return -ENOMEM; diff --git a/src/core/mount.c b/src/core/mount.c index fab922ea9e..15d5f21530 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -1534,7 +1534,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { goto clean_up; } - o = join(options, ",", options2, NULL); + o = strjoin(options, ",", options2, NULL); if (!o) { r = -ENOMEM; goto finish; diff --git a/src/core/service.c b/src/core/service.c index e57b0e970c..2be6ee5d99 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -722,7 +722,7 @@ static int service_load_sysv_path(Service *s, const char *path) { char *d = NULL; if (chkconfig_description) - d = join(chkconfig_description, " ", j, NULL); + d = strjoin(chkconfig_description, " ", j, NULL); else d = strdup(j); @@ -879,7 +879,7 @@ static int service_load_sysv_path(Service *s, const char *path) { char *d = NULL; if (long_description) - d = join(long_description, " ", t, NULL); + d = strjoin(long_description, " ", t, NULL); else d = strdup(j); @@ -1001,7 +1001,7 @@ static int service_load_sysv_name(Service *s, const char *name) { char *path; int r; - path = join(*p, "/", name, NULL); + path = strjoin(*p, "/", name, NULL); if (!path) return -ENOMEM; @@ -1023,7 +1023,7 @@ static int service_load_sysv_name(Service *s, const char *name) { if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) { /* Try SUSE style boot.* init scripts */ - path = join(*p, "/boot.", name, NULL); + path = strjoin(*p, "/boot.", name, NULL); if (!path) return -ENOMEM; @@ -1038,7 +1038,7 @@ static int service_load_sysv_name(Service *s, const char *name) { if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) { /* Try Frugalware style rc.* init scripts */ - path = join(*p, "/rc.", name, NULL); + path = strjoin(*p, "/rc.", name, NULL); if (!path) return -ENOMEM; @@ -3407,7 +3407,7 @@ static int service_enumerate(Manager *m) { struct dirent *de; free(path); - path = join(*p, "/", rcnd_table[i].path, NULL); + path = strjoin(*p, "/", rcnd_table[i].path, NULL); if (!path) { r = -ENOMEM; goto finish; @@ -3442,7 +3442,7 @@ static int service_enumerate(Manager *m) { continue; free(fpath); - fpath = join(path, "/", de->d_name, NULL); + fpath = strjoin(path, "/", de->d_name, NULL); if (!fpath) { r = -ENOMEM; goto finish; diff --git a/src/core/unit.c b/src/core/unit.c index 37711afeaf..516f4fad8b 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1891,10 +1891,10 @@ static char *default_cgroup_path(Unit *u) { if (!t) return NULL; - p = join(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL); + p = strjoin(u->manager->cgroup_hierarchy, "/", t, "/", u->instance, NULL); free(t); } else - p = join(u->manager->cgroup_hierarchy, "/", u->id, NULL); + p = strjoin(u->manager->cgroup_hierarchy, "/", u->id, NULL); return p; } diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index f714c8c241..7801de64b5 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -88,7 +88,7 @@ static int create_disk( goto fail; } - p = join(arg_dest, "/", n, NULL); + p = strjoin(arg_dest, "/", n, NULL); if (!p) { r = -ENOMEM; log_error("Failed to allocate unit file name."); @@ -175,7 +175,7 @@ static int create_disk( if (!noauto) { - to = join(arg_dest, "/", d, ".wants/", n, NULL); + to = strjoin(arg_dest, "/", d, ".wants/", n, NULL); if (!to) { r = -ENOMEM; goto fail; @@ -191,9 +191,9 @@ static int create_disk( free(to); if (!nofail) - to = join(arg_dest, "/cryptsetup.target.requires/", n, NULL); + to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL); else - to = join(arg_dest, "/cryptsetup.target.wants/", n, NULL); + to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL); if (!to) { r = -ENOMEM; goto fail; @@ -211,7 +211,7 @@ static int create_disk( } e = unit_name_escape(name); - to = join(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL); + to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL); if (!to) { r = -ENOMEM; goto fail; diff --git a/src/delta/delta.c b/src/delta/delta.c index 01c6335315..eef6536b01 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -192,7 +192,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, const char *path) { if (!dirent_is_file(de)) continue; - p = join(path, "/", de->d_name, NULL); + p = strjoin(path, "/", de->d_name, NULL); if (!p) { r = -ENOMEM; goto finish; @@ -254,7 +254,7 @@ static int process_suffix(const char *prefixes, const char *suffix) { NULSTR_FOREACH(p, prefixes) { char *t; - t = join(p, "/", suffix, NULL); + t = strjoin(p, "/", suffix, NULL); if (!t) { r = -ENOMEM; goto finish; diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index f832730b40..3a59b85d66 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -103,7 +103,7 @@ static int add_swap(const char *what, struct mntent *me) { goto finish; } - unit = join(arg_dest, "/", name, NULL); + unit = strjoin(arg_dest, "/", name, NULL); if (!unit) { log_error("Out of memory"); r = -ENOMEM; @@ -146,7 +146,7 @@ static int add_swap(const char *what, struct mntent *me) { } if (!noauto) { - lnk = join(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL); + lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL); if (!lnk) { log_error("Out of memory"); r = -ENOMEM; @@ -169,7 +169,7 @@ static int add_swap(const char *what, struct mntent *me) { if (r > 0) { free(lnk); - lnk = join(arg_dest, "/", device, ".wants/", name, NULL); + lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL); if (!lnk) { log_error("Out of memory"); r = -ENOMEM; @@ -261,7 +261,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { goto finish; } - unit = join(arg_dest, "/", name, NULL); + unit = strjoin(arg_dest, "/", name, NULL); if (!unit) { log_error("Out of memory"); r = -ENOMEM; @@ -321,7 +321,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { } if (!noauto) { - lnk = join(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL); + lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL); if (!lnk) { log_error("Out of memory"); r = -ENOMEM; @@ -347,7 +347,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { if (r > 0) { free(lnk); - lnk = join(arg_dest, "/", device, ".wants/", name, NULL); + lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL); if (!lnk) { log_error("Out of memory"); r = -ENOMEM; @@ -372,7 +372,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { goto finish; } - automount_unit = join(arg_dest, "/", automount_name, NULL); + automount_unit = strjoin(arg_dest, "/", automount_name, NULL); if (!automount_unit) { log_error("Out of memory"); r = -ENOMEM; @@ -408,7 +408,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) { } free(lnk); - lnk = join(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL); + lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL); if (!lnk) { log_error("Out of memory"); r = -ENOMEM; diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index bb7c225e02..b2e3eb6393 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -39,7 +39,7 @@ static int add_symlink(const char *fservice, const char *tservice) { assert(tservice); from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice); - to = join(arg_dest,"/getty.target.wants/", tservice, NULL); + to = strjoin(arg_dest,"/getty.target.wants/", tservice, NULL); if (!from || !to) { log_error("Out of memory"); diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 300677bb92..fcd0d1e625 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -213,14 +213,14 @@ int main(int argc, char* argv[]) { IOVEC_SET_STRING(iovec[j++], core_cmdline); } - core_timestamp = join("COREDUMP_TIMESTAMP=", argv[ARG_TIMESTAMP], "000000", NULL); + core_timestamp = strjoin("COREDUMP_TIMESTAMP=", argv[ARG_TIMESTAMP], "000000", NULL); if (core_timestamp) IOVEC_SET_STRING(iovec[j++], core_timestamp); IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1"); IOVEC_SET_STRING(iovec[j++], "PRIORITY=2"); - core_message = join("MESSAGE=Process ", argv[ARG_PID], " (", argv[ARG_COMM], ") dumped core.", NULL); + core_message = strjoin("MESSAGE=Process ", argv[ARG_PID], " (", argv[ARG_COMM], ") dumped core.", NULL); if (core_message) IOVEC_SET_STRING(iovec[j++], core_message); diff --git a/src/journal/journald.c b/src/journal/journald.c index 2402f7f6d0..fd292f019e 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -1976,7 +1976,7 @@ static int system_journal_open(Server *s) { (void) mkdir(fn, 0755); free(fn); - fn = join("/var/log/journal/", ids, "/system.journal", NULL); + fn = strjoin("/var/log/journal/", ids, "/system.journal", NULL); if (!fn) return -ENOMEM; @@ -2002,7 +2002,7 @@ static int system_journal_open(Server *s) { if (!s->runtime_journal && (s->storage != STORAGE_NONE)) { - fn = join("/run/log/journal/", ids, "/system.journal", NULL); + fn = strjoin("/run/log/journal/", ids, "/system.journal", NULL); if (!fn) return -ENOMEM; diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 4bcc65c5c7..57572d4f01 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -313,7 +313,7 @@ static char *match_make_string(Match *m) { } if (p) { - k = join(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL); + k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL); free(p); free(t); @@ -330,7 +330,7 @@ static char *match_make_string(Match *m) { } if (enclose) { - r = join("(", p, ")", NULL); + r = strjoin("(", p, ")", NULL); free(p); return r; } @@ -1101,7 +1101,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) { (startswith(filename, "system@") && endswith(filename, ".journal")))) return 0; - path = join(prefix, "/", filename, NULL); + path = strjoin(prefix, "/", filename, NULL); if (!path) return -ENOMEM; @@ -1149,7 +1149,7 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename) assert(prefix); assert(filename); - path = join(prefix, "/", filename, NULL); + path = strjoin(prefix, "/", filename, NULL); if (!path) return -ENOMEM; @@ -1184,7 +1184,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname) !sd_id128_equal(id, mid))) return 0; - path = join(prefix, "/", dirname, NULL); + path = strjoin(prefix, "/", dirname, NULL); if (!path) return -ENOMEM; diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 6740d3b885..b0d378de5a 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -522,16 +522,16 @@ static int join_path(const char *controller, const char *path, const char *suffi if (controller) { if (path && suffix) - t = join("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL); + t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL); else if (path) - t = join("/sys/fs/cgroup/", controller, "/", path, NULL); + t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL); else if (suffix) - t = join("/sys/fs/cgroup/", controller, "/", suffix, NULL); + t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL); else - t = join("/sys/fs/cgroup/", controller, NULL); + t = strjoin("/sys/fs/cgroup/", controller, NULL); } else { if (path && suffix) - t = join(path, "/", suffix, NULL); + t = strjoin(path, "/", suffix, NULL); else if (path) t = strdup(path); } diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 8c62fb959b..1eccec5989 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -90,7 +90,7 @@ int config_item_perf_lookup( else { char *key; - key = join(section, ".", lvalue, NULL); + key = strjoin(section, ".", lvalue, NULL); if (!key) return -ENOMEM; diff --git a/src/shared/hwclock.c b/src/shared/hwclock.c index d40bb2653f..9f8ab08e2b 100644 --- a/src/shared/hwclock.c +++ b/src/shared/hwclock.c @@ -74,7 +74,7 @@ static int rtc_open(int flags) { if (ignore_file(de->d_name)) continue; - p = join("/sys/class/rtc/", de->d_name, "/hctosys", NULL); + p = strjoin("/sys/class/rtc/", de->d_name, "/hctosys", NULL); if (!p) { closedir(d); return -ENOMEM; diff --git a/src/shared/path-util.c b/src/shared/path-util.c index ccd7667608..8bc7955020 100644 --- a/src/shared/path-util.c +++ b/src/shared/path-util.c @@ -120,7 +120,7 @@ char *path_make_absolute(const char *p, const char *prefix) { if (path_is_absolute(p) || !prefix) return strdup(p); - return join(prefix, "/", p, NULL); + return strjoin(prefix, "/", p, NULL); } char *path_make_absolute_cwd(const char *p) { diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index 3e437b77a1..fcf5902c78 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -208,7 +208,7 @@ char *unit_name_build(const char *prefix, const char *instance, const char *suff if (!instance) return strappend(prefix, suffix); - return join(prefix, "@", instance, suffix, NULL); + return strjoin(prefix, "@", instance, suffix, NULL); } static char *do_escape_char(char c, char *t) { @@ -425,7 +425,7 @@ char *unit_name_from_path_instance(const char *prefix, const char *path, const c if (!p) return NULL; - r = join(prefix, "@", p, suffix, NULL); + r = strjoin(prefix, "@", p, suffix, NULL); free(p); return r; diff --git a/src/shared/util.c b/src/shared/util.c index 63471899fd..2aabd8d634 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1083,7 +1083,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char * if (h < 0) return h; - r = join("[", t, "]", NULL); + r = strjoin("[", t, "]", NULL); free(t); if (!r) @@ -5145,7 +5145,7 @@ finish: return r; } -char *join(const char *x, ...) { +char *strjoin(const char *x, ...) { va_list ap; size_t l; char *r, *p; diff --git a/src/shared/util.h b/src/shared/util.h index c8d048f9b2..d9b656d2ca 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -451,7 +451,7 @@ int dirent_ensure_type(DIR *d, struct dirent *de); int in_search_path(const char *path, char **search); int get_files_in_directory(const char *path, char ***list); -char *join(const char *x, ...) _sentinel_; +char *strjoin(const char *x, ...) _sentinel_; bool is_main_thread(void); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 2d5d90d265..3b52b9889c 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1297,7 +1297,7 @@ static char *resolve_fragment(const char *fragment, const char **search_paths) { return strdup(fragment); STRV_FOREACH(p, search_paths) { - resolved_path = join(*p, "/", fragment, NULL); + resolved_path = strjoin(*p, "/", fragment, NULL); if (resolved_path == NULL) { log_error("Out of memory"); return NULL; -- cgit v1.2.3-54-g00ecf