summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/cgroup-util.c2
-rw-r--r--src/shared/condition.c2
-rw-r--r--src/shared/conf-files.c2
-rw-r--r--src/shared/generator.c2
-rw-r--r--src/shared/install.c4
-rw-r--r--src/shared/logs-show.c16
-rw-r--r--src/shared/machine-image.c8
-rw-r--r--src/shared/pager.c2
-rw-r--r--src/shared/path-util.c6
-rw-r--r--src/shared/switch-root.c2
-rw-r--r--src/shared/time-util.c2
-rw-r--r--src/shared/util.c6
-rw-r--r--src/shared/util.h26
14 files changed, 41 insertions, 41 deletions
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index ea66c76724..cbd94e86d9 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -93,7 +93,7 @@ static int show_cgroup_one_by_path(const char *path, const char *prefix, unsigne
if (r < 0)
return r;
- fn = strappenda(p, "/cgroup.procs");
+ fn = strjoina(p, "/cgroup.procs");
f = fopen(fn, "re");
if (!f)
return -errno;
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 0d3cc53517..b527868e6b 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -510,7 +510,7 @@ static int check_hierarchy(const char *p) {
return 0;
/* Check if this controller actually really exists */
- cc = strappenda("/sys/fs/cgroup/", p);
+ cc = strjoina("/sys/fs/cgroup/", p);
if (laccess(cc, F_OK) < 0)
return -errno;
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 4faca2b8dc..da7560f05f 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -288,7 +288,7 @@ static int condition_test_needs_update(Condition *c) {
if (!path_is_absolute(c->parameter))
return true;
- p = strappenda(c->parameter, "/.updated");
+ p = strjoina(c->parameter, "/.updated");
if (lstat(p, &other) < 0)
return true;
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 51f4e0105c..db4937db88 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -44,7 +44,7 @@ static int files_add(Hashmap *h, const char *root, const char *path, const char
assert(path);
assert(suffix);
- dirpath = strappenda(root ? root : "", path);
+ dirpath = strjoina(root ? root : "", path);
dir = opendir(dirpath);
if (!dir) {
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 4140afba82..7f16d5cbef 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -62,7 +62,7 @@ int generator_write_fsck_deps(
if (streq(where, "/")) {
char *lnk;
- lnk = strappenda(dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
+ lnk = strjoina(dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
mkdir_parents(lnk, 0755);
if (symlink(SYSTEM_DATA_UNIT_PATH "/systemd-fsck-root.service", lnk) < 0)
diff --git a/src/shared/install.c b/src/shared/install.c
index 37191a7c71..65f1c245c6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1048,7 +1048,7 @@ static int unit_file_load(
assert(path);
if (!isempty(root_dir))
- path = strappenda(root_dir, "/", path);
+ path = strjoina(root_dir, "/", path);
if (!load) {
r = access(path, F_OK) ? -errno : 0;
@@ -1730,7 +1730,7 @@ int unit_file_set_default(
if (r < 0)
return r;
- path = strappenda(config_path, "/" SPECIAL_DEFAULT_TARGET);
+ path = strjoina(config_path, "/" SPECIAL_DEFAULT_TARGET);
r = create_symlink(i->path, path, force, changes, n_changes);
if (r < 0)
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index b7a99d2c23..45741f9e9d 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -1033,10 +1033,10 @@ int add_matches_for_unit(sd_journal *j, const char *unit) {
assert(j);
assert(unit);
- m1 = strappenda("_SYSTEMD_UNIT=", unit);
- m2 = strappenda("COREDUMP_UNIT=", unit);
- m3 = strappenda("UNIT=", unit);
- m4 = strappenda("OBJECT_SYSTEMD_UNIT=", unit);
+ m1 = strjoina("_SYSTEMD_UNIT=", unit);
+ m2 = strjoina("COREDUMP_UNIT=", unit);
+ m3 = strjoina("UNIT=", unit);
+ m4 = strjoina("OBJECT_SYSTEMD_UNIT=", unit);
(void)(
/* Look for messages from the service itself */
@@ -1080,10 +1080,10 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) {
assert(j);
assert(unit);
- m1 = strappenda("_SYSTEMD_USER_UNIT=", unit);
- m2 = strappenda("USER_UNIT=", unit);
- m3 = strappenda("COREDUMP_USER_UNIT=", unit);
- m4 = strappenda("OBJECT_SYSTEMD_USER_UNIT=", unit);
+ m1 = strjoina("_SYSTEMD_USER_UNIT=", unit);
+ m2 = strjoina("USER_UNIT=", unit);
+ m3 = strjoina("COREDUMP_USER_UNIT=", unit);
+ m4 = strjoina("OBJECT_SYSTEMD_USER_UNIT=", unit);
sprintf(muid, "_UID="UID_FMT, uid);
(void) (
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 8ea61052bd..8d61507e84 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -425,7 +425,7 @@ int image_rename(Image *i, const char *new_name) {
case IMAGE_RAW: {
const char *fn;
- fn = strappenda(new_name, ".raw");
+ fn = strjoina(new_name, ".raw");
new_path = file_in_same_dir(i->path, fn);
break;
}
@@ -486,13 +486,13 @@ int image_clone(Image *i, const char *new_name, bool read_only) {
case IMAGE_SUBVOLUME:
case IMAGE_DIRECTORY:
- new_path = strappenda("/var/lib/machines/", new_name);
+ new_path = strjoina("/var/lib/machines/", new_name);
r = btrfs_subvol_snapshot(i->path, new_path, read_only, true);
break;
case IMAGE_RAW:
- new_path = strappenda("/var/lib/machines/", new_name, ".raw");
+ new_path = strjoina("/var/lib/machines/", new_name, ".raw");
r = copy_file_atomic(i->path, new_path, read_only ? 0444 : 0644, false, FS_NOCOW_FL);
break;
@@ -629,7 +629,7 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
return -EBUSY;
mkdir_p("/run/systemd/nspawn/locks", 0600);
- p = strappenda("/run/systemd/nspawn/locks/name-", name);
+ p = strjoina("/run/systemd/nspawn/locks/name-", name);
return make_lock_file(p, operation, ret);
}
diff --git a/src/shared/pager.c b/src/shared/pager.c
index a9f2b7e4f4..8635d9a600 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -91,7 +91,7 @@ int pager_open(bool jump_to_end) {
if (!less_opts)
less_opts = "FRSXMK";
if (jump_to_end)
- less_opts = strappenda(less_opts, " +G");
+ less_opts = strjoina(less_opts, " +G");
setenv("LESS", less_opts, 1);
/* Make sure the pager goes away when the parent dies */
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 00d2d44993..b9db7f1047 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -560,14 +560,14 @@ int path_is_os_tree(const char *path) {
int r;
/* We use /usr/lib/os-release as flag file if something is an OS */
- p = strappenda(path, "/usr/lib/os-release");
+ p = strjoina(path, "/usr/lib/os-release");
r = access(p, F_OK);
if (r >= 0)
return 1;
/* Also check for the old location in /etc, just in case. */
- p = strappenda(path, "/etc/os-release");
+ p = strjoina(path, "/etc/os-release");
r = access(p, F_OK);
return r >= 0;
@@ -665,7 +665,7 @@ int fsck_exists(const char *fstype) {
const char *checker;
int r;
- checker = strappenda("fsck.", fstype);
+ checker = strjoina("fsck.", fstype);
r = find_binary(checker, true, &p);
if (r < 0)
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index e8cedc69cc..813641ad44 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -51,7 +51,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot,
if (path_equal(new_root, "/"))
return 0;
- temporary_old_root = strappenda(new_root, oldroot);
+ temporary_old_root = strjoina(new_root, oldroot);
mkdir_p_label(temporary_old_root, 0755);
old_root_remove = in_initrd();
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index d3404afd55..947ac1fcfb 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -965,7 +965,7 @@ bool timezone_is_valid(const char *name) {
if (slash)
return false;
- t = strappenda("/usr/share/zoneinfo/", name);
+ t = strjoina("/usr/share/zoneinfo/", name);
if (stat(t, &st) < 0)
return false;
diff --git a/src/shared/util.c b/src/shared/util.c
index 11cab6dcf1..c53f9cdb6a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -6452,7 +6452,7 @@ int container_get_leader(const char *machine, pid_t *pid) {
assert(machine);
assert(pid);
- p = strappenda("/run/systemd/machines/", machine);
+ p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL);
if (r == -ENOENT)
return -EHOSTDOWN;
@@ -6691,7 +6691,7 @@ int open_tmpfile(const char *path, int flags) {
#endif
/* Fall back to unguessable name + unlinking */
- p = strappenda(path, "/systemd-tmp-XXXXXX");
+ p = strjoina(path, "/systemd-tmp-XXXXXX");
fd = mkostemp_safe(p, flags);
if (fd < 0)
@@ -7220,7 +7220,7 @@ int take_password_lock(const char *root) {
* awfully racy, and thus we just won't do them. */
if (root)
- path = strappenda(root, "/etc/.pwd.lock");
+ path = strjoina(root, "/etc/.pwd.lock");
else
path = "/etc/.pwd.lock";
diff --git a/src/shared/util.h b/src/shared/util.h
index 410ce65f14..7dfabbc07d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -931,19 +931,19 @@ int unlink_noerrno(const char *path);
(void*)memset(_new_, 0, _size_); \
})
-#define strappenda(a, ...) \
- ({ \
- int _len = strlen(a); \
- unsigned _i; \
- char *_d_, *_p_; \
- const char *_appendees_[] = { __VA_ARGS__ }; \
- for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
- _len += strlen(_appendees_[_i]); \
- _d_ = alloca(_len + 1); \
- _p_ = stpcpy(_d_, a); \
- for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
- _p_ = stpcpy(_p_, _appendees_[_i]); \
- _d_; \
+#define strjoina(a, ...) \
+ ({ \
+ const char *_appendees_[] = { a, __VA_ARGS__ }; \
+ char *_d_, *_p_; \
+ int _len_ = 0; \
+ unsigned _i_; \
+ for (_i_ = 0; _i_ < ELEMENTSOF(_appendees_) && _appendees_[_i_]; _i_++) \
+ _len_ += strlen(_appendees_[_i_]); \
+ _p_ = _d_ = alloca(_len_ + 1); \
+ for (_i_ = 0; _i_ < ELEMENTSOF(_appendees_) && _appendees_[_i_]; _i_++) \
+ _p_ = stpcpy(_p_, _appendees_[_i_]); \
+ *_p_ = 0; \
+ _d_; \
})
#define procfs_file_alloca(pid, field) \