summaryrefslogtreecommitdiffstats
path: root/src/nspawn
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2019-06-07 10:27:18 +0200
committerFranck Bui <fbui@suse.com>2019-06-18 09:27:06 +0200
commitdc98caea32c7eced94ad22f75ffa77753dac5b1d (patch)
treec7954a83063e10f5ebdf517aaf310a3ea27c39ef /src/nspawn
parentterminal-util: introduce openpt_allocate() (diff)
downloadsystemd-dc98caea32c7eced94ad22f75ffa77753dac5b1d.tar.xz
systemd-dc98caea32c7eced94ad22f75ffa77753dac5b1d.zip
nspawn: make use of openpt_allocate()
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 085a9806ce..5079918ae1 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2923,17 +2923,9 @@ static int inner_child(
_cleanup_free_ char *console = NULL;
/* Allocate a pty and make it available as /dev/console. */
-
- master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
+ master = openpt_allocate(O_RDWR|O_NONBLOCK, &console);
if (master < 0)
- return log_error_errno(errno, "Failed to acquire pseudo tty: %m");
-
- r = ptsname_malloc(master, &console);
- 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 allocate a pty: %m");
r = setup_dev_console(console);
if (r < 0)