[lxc-devel] [lxc/master] exit with error if no controlling tty is available

elpollodiablo on Github lxc-bot at linuxcontainers.org
Sat Sep 10 06:28:16 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 433 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160910/148da29d/attachment.bin>
-------------- next part --------------
From 9ad2b71364d3477f9c03ff305b41a7e8e7827050 Mon Sep 17 00:00:00 2001
From: Philip Poten <philip.poten at gmail.com>
Date: Sat, 10 Sep 2016 08:27:51 +0200
Subject: [PATCH] exit with error if no controlling tty is available

Avoids a segfault in lxc_attach.c: get_pty_on_host when executed with su: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1567037
---
 src/lxc/console.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/console.c b/src/lxc/console.c
index 052512e..4c3e60a 100644
--- a/src/lxc/console.c
+++ b/src/lxc/console.c
@@ -527,6 +527,11 @@ int lxc_console_create(struct lxc_conf *conf)
 
 	lxc_console_peer_default(console);
 
+	if (console->peer < 0) {
+		SYSERROR("failed to open console peer - no controlling tty?");
+		goto err;
+	}
+
 	if (console->log_path) {
 		console->log_fd = lxc_unpriv(open(console->log_path,
 						  O_CLOEXEC | O_RDWR |


More information about the lxc-devel mailing list