[lxc-devel] [lxd/master] lxd/instance/lxc: Add extra check for devpts_fd

stgraber on Github lxc-bot at linuxcontainers.org
Sun Nov 15 03:44:18 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 448 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201114/d5a85db2/attachment.bin>
-------------- next part --------------
From 8358159f533e3a83b0c72ce3e18757370df281d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 14 Nov 2020 22:43:29 -0500
Subject: [PATCH] lxd/instance/lxc: Add extra check for devpts_fd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Don't attempt to call the function if we don't have the runtime extension.

Closes #8159

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/instance/drivers/driver_lxc.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/instance/drivers/driver_lxc.go b/lxd/instance/drivers/driver_lxc.go
index 6e59fcfe72..83f1170d81 100644
--- a/lxd/instance/drivers/driver_lxc.go
+++ b/lxd/instance/drivers/driver_lxc.go
@@ -6631,6 +6631,10 @@ func (c *lxc) DevptsFd() (*os.File, error) {
 		return nil, err
 	}
 
+	if !liblxc.HasApiExtension("devpts_fd") {
+		return nil, fmt.Errorf("Missing devpts_fd extension")
+	}
+
 	return c.c.DevptsFd()
 }
 


More information about the lxc-devel mailing list