diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c index 14d3160cd..327b4df5b 100644 --- a/src/lxc/af_unix.c +++ b/src/lxc/af_unix.c @@ -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); diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c index 029e36bbb..6e1a2c288 100644 --- a/src/lxc/terminal.c +++ b/src/lxc/terminal.c @@ -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; }