From 7a3165591780609a4545979c6eb66d640b8a1fa5 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 15 Jul 2021 22:09:31 +0200 Subject: [PATCH] terminal: fix error handling Fixes: f382bcc6d820 ("terminal: log TIOCGPTPEER failure less alarmingly") Signed-off-by: Christian Brauner --- src/lxc/terminal.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c index 6e1a2c288..2c73c8f27 100644 --- a/src/lxc/terminal.c +++ b/src/lxc/terminal.c @@ -920,8 +920,12 @@ static int lxc_terminal_create_native(const char *name, const char *lxcpath, str return log_error_errno(-1, errno, "Failed to receive devpts fd"); terminal->ptx = open_beneath(devpts_fd, "ptmx", O_RDWR | O_NOCTTY | O_CLOEXEC); - if (terminal->ptx < 0) - return log_error_errno(-1, errno, "Failed to open terminal multiplexer device"); + if (terminal->ptx < 0) { + if (errno == ENOSPC) + return systrace("Exceeded number of allocatable terminals"); + + return syserror("Failed to open terminal multiplexer device"); + } ret = unlockpt(terminal->ptx); if (ret < 0) { @@ -936,7 +940,7 @@ static int lxc_terminal_create_native(const char *name, const char *lxcpath, str SYSTRACE("Pure fd-based terminal allocation not possible"); break; case ENOSPC: - SYSTRACE("Exceeding number of allocatable terminals"); + SYSTRACE("Exceeded number of allocatable terminals"); break; default: SYSWARN("Failed to allocate new pty device"); -- 2.47.2