vmspawn: properly exit in vmspawn child on failure

This commit is contained in:
Lennart Poettering
2025-03-10 16:41:43 +01:00
parent e267f42d91
commit 0d4f38732b
+9 -4
View File
@@ -2265,14 +2265,19 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
return r;
if (r == 0) {
/* set TERM and LANG if they are missing */
if (setenv("TERM", "vt220", 0) < 0)
return log_oom();
if (setenv("TERM", "vt220", 0) < 0) {
log_oom();
goto fail;
}
if (setenv("LANG", "C.UTF-8", 0) < 0)
return log_oom();
if (setenv("LANG", "C.UTF-8", 0) < 0) {
log_oom();
goto fail;
}
execv(qemu_binary, cmdline);
log_error_errno(errno, "Failed to execve %s: %m", qemu_binary);
fail:
_exit(EXIT_FAILURE);
}