diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-11-03 13:59:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 13:59:20 -0600 |
commit | 493fd52f1ada36bfe63301d4bb50f7fd2b38c670 (patch) | |
tree | 19864f5568a2fe48181c1b3f33c46b4db36dd768 /src/nspawn | |
parent | a1e2ef7ec912902d8142e7cb5830cbfb47dba86c (diff) | |
parent | 9aa2169eaeb20994fb2b0196c051cff52f57a93d (diff) |
Merge pull request #4510 from keszybz/tree-wide-cleanups
Tree wide cleanups
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-mount.c | 20 | ||||
-rw-r--r-- | src/nspawn/nspawn.c | 4 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index 115de64cf9..392498d1bb 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -193,11 +193,9 @@ static int tmpfs_patch_options( if ((userns && uid_shift != 0) || patch_ids) { assert(uid_shift != UID_INVALID); - if (options) - (void) asprintf(&buf, "%s,uid=" UID_FMT ",gid=" UID_FMT, options, uid_shift, uid_shift); - else - (void) asprintf(&buf, "uid=" UID_FMT ",gid=" UID_FMT, uid_shift, uid_shift); - if (!buf) + if (asprintf(&buf, "%s%suid=" UID_FMT ",gid=" UID_FMT, + options ?: "", options ? "," : "", + uid_shift, uid_shift) < 0) return -ENOMEM; options = buf; @@ -207,16 +205,12 @@ static int tmpfs_patch_options( if (selinux_apifs_context) { char *t; - if (options) - t = strjoin(options, ",context=\"", selinux_apifs_context, "\"", NULL); - else - t = strjoin("context=\"", selinux_apifs_context, "\"", NULL); - if (!t) { - free(buf); + t = strjoin(options ?: "", options ? "," : "", + "context=\"", selinux_apifs_context, "\""); + free(buf); + if (!t) return -ENOMEM; - } - free(buf); buf = t; } #endif diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index c56af6e6f4..673e616911 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -2547,7 +2547,7 @@ static int determine_names(void) { * search for a machine, but instead create a new one * in /var/lib/machine. */ - arg_directory = strjoin("/var/lib/machines/", arg_machine, NULL); + arg_directory = strjoin("/var/lib/machines/", arg_machine); if (!arg_directory) return log_oom(); } @@ -3390,7 +3390,7 @@ static int load_settings(void) { FOREACH_STRING(i, "/etc/systemd/nspawn", "/run/systemd/nspawn") { _cleanup_free_ char *j = NULL; - j = strjoin(i, "/", fn, NULL); + j = strjoin(i, "/", fn); if (!j) return log_oom(); |