summaryrefslogtreecommitdiffstats
path: root/src/vmspawn
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-05-19 01:59:24 +0200
committerMike Yuan <me@yhndnzj.com>2024-05-19 03:18:48 +0200
commit6d2a26a1367b0203d38e22132eaa96a05ed1438a (patch)
tree46c45d67ebb309e869a0f0363a84dc35b93d80f0 /src/vmspawn
parentptyfwd: trivial coding style and log cleanups (diff)
downloadsystemd-6d2a26a1367b0203d38e22132eaa96a05ed1438a.tar.xz
systemd-6d2a26a1367b0203d38e22132eaa96a05ed1438a.zip
vmspawn: use openpt_allocate where appropriate
Diffstat (limited to 'src/vmspawn')
-rw-r--r--src/vmspawn/vmspawn.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c
index 4a6ef759a5..326722db05 100644
--- a/src/vmspawn/vmspawn.c
+++ b/src/vmspawn/vmspawn.c
@@ -1572,16 +1572,9 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
case CONSOLE_INTERACTIVE: {
_cleanup_free_ char *pty_path = NULL;
- master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
+ master = openpt_allocate(O_RDWR|O_NONBLOCK, &pty_path);
if (master < 0)
- return log_error_errno(errno, "Failed to acquire pseudo tty: %m");
-
- r = ptsname_malloc(master, &pty_path);
- if (r < 0)
- return log_error_errno(r, "Failed to determine tty name: %m");
-
- if (unlockpt(master) < 0)
- return log_error_errno(errno, "Failed to unlock tty: %m");
+ return log_error_errno(master, "Failed to setup pty: %m");
if (strv_extend_many(
&cmdline,