]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
terminal: fix error handling 3908/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 15 Jul 2021 20:09:31 +0000 (22:09 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 15 Jul 2021 20:09:31 +0000 (22:09 +0200)
Fixes: f382bcc6d820 ("terminal: log TIOCGPTPEER failure less alarmingly")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/terminal.c

index 6e1a2c2887295c65dc49a4dbe23854dd6f827e57..2c73c8f27841aa36c7e1376da337024a07b54816 100644 (file)
@@ -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");