util: rework strappenda(), and rename it strjoina()

After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
This commit is contained in:
Lennart Poettering
2015-02-03 02:05:59 +01:00
parent 44de0efc6e
commit 63c372cb9d
75 changed files with 248 additions and 237 deletions
+2 -2
View File
@@ -81,7 +81,7 @@ static uid_t search_uid = UID_INVALID;
static UidRange *uid_range = NULL;
static unsigned n_uid_range = 0;
#define fix_root(x) (arg_root ? strappenda(arg_root, x) : x)
#define fix_root(x) (arg_root ? strjoina(arg_root, x) : x)
static int load_user_database(void) {
_cleanup_fclose_ FILE *f = NULL;
@@ -217,7 +217,7 @@ static int make_backup(const char *target, const char *x) {
/* Don't fail on chmod() or chown(). If it stays owned by us
* and/or unreadable by others, then it isn't too bad... */
backup = strappenda(x, "-");
backup = strjoina(x, "-");
/* Copy over the access mask */
if (fchmod(fileno(dst), st.st_mode & 07777) < 0)