Merge pull request #3907 from brauner/2021-07-15.fixes.3

terminal: log TIOCGPTPEER failure less alarmingly
This commit is contained in:
Stéphane Graber 2021-07-15 13:19:26 -04:00 committed by GitHub
commit 8cff10d6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -121,6 +121,9 @@ int lxc_abstract_unix_send_fds_iov(int fd, const int *sendfds, int num_sendfds,
struct cmsghdr *cmsg = NULL;
size_t cmsgbufsize = CMSG_SPACE(num_sendfds * sizeof(int));
if (num_sendfds <= 0)
return ret_errno(EINVAL);
cmsgbuf = malloc(cmsgbufsize);
if (!cmsgbuf)
return ret_errno(-ENOMEM);

View File

@ -931,7 +931,17 @@ static int lxc_terminal_create_native(const char *name, const char *lxcpath, str
terminal->pty = ioctl(terminal->ptx, TIOCGPTPEER, O_RDWR | O_NOCTTY | O_CLOEXEC);
if (terminal->pty < 0) {
SYSWARN("Failed to allocate new pty device");
switch (errno) {
case ENOTTY:
SYSTRACE("Pure fd-based terminal allocation not possible");
break;
case ENOSPC:
SYSTRACE("Exceeding number of allocatable terminals");
break;
default:
SYSWARN("Failed to allocate new pty device");
break;
}
goto err;
}