From: Mike Yuan Date: Sat, 18 May 2024 23:59:24 +0000 (+0800) Subject: vmspawn: use openpt_allocate where appropriate X-Git-Tag: v256-rc3~32^2~2 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=6d2a26a1367b0203d38e22132eaa96a05ed1438a;p=systemd%2F.git vmspawn: use openpt_allocate where appropriate --- 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,