summaryrefslogtreecommitdiffstats
path: root/src/vmspawn
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-09-19 23:58:00 +0200
committerMike Yuan <me@yhndnzj.com>2024-09-21 00:53:50 +0200
commita2c8652a2a9cb8f33af3fb912fdfe155ae5ff3ef (patch)
tree0c660fd49807584607d78d3d415a65e53d43193c /src/vmspawn
parentbasic/strv: introduce strv_extend_strv_consume() (diff)
downloadsystemd-a2c8652a2a9cb8f33af3fb912fdfe155ae5ff3ef.tar.xz
systemd-a2c8652a2a9cb8f33af3fb912fdfe155ae5ff3ef.zip
tree-wide: use strv_extend_strv_consume() where appropriate
Diffstat (limited to 'src/vmspawn')
-rw-r--r--src/vmspawn/vmspawn.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c
index 15418f0742..7474b301f3 100644
--- a/src/vmspawn/vmspawn.c
+++ b/src/vmspawn/vmspawn.c
@@ -2088,14 +2088,11 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
const char *e = secure_getenv("SYSTEMD_VMSPAWN_QEMU_EXTRA");
if (e) {
- _cleanup_strv_free_ char **extra = NULL;
-
- r = strv_split_full(&extra, e, /* separator= */ NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
+ r = strv_split_and_extend_full(&cmdline, e,
+ /* separator = */ NULL, /* filter_duplicates = */ false,
+ EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
if (r < 0)
- return log_error_errno(r, "Failed to split $SYSTEMD_VMSPAWN_QEMU_EXTRA environment variable: %m");
-
- if (strv_extend_strv(&cmdline, extra, /* filter_duplicates= */ false) < 0)
- return log_oom();
+ return log_error_errno(r, "Failed to parse $SYSTEMD_VMSPAWN_QEMU_EXTRA: %m");
}
if (DEBUG_LOGGING) {