[lxc-devel] [lxd/master] lxd/containers: Skip sockets in tarballs

stgraber on Github lxc-bot at linuxcontainers.org
Mon Nov 20 19:05:34 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171120/1a6fb4bc/attachment.bin>
-------------- next part --------------
From 6d6979e21ca12d37a15ca75a5f4e95a4885f097b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Nov 2017 14:05:08 -0500
Subject: [PATCH] lxd/containers: Skip sockets in tarballs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index f223fb702..918600c3c 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -5385,6 +5385,11 @@ func (c *containerLXC) tarStoreFile(linkmap map[uint64]string, offset int, tw *t
 		}
 	}
 
+	// Sockets cannot be stored in tarballs, just skip them (consistent with tar)
+	if fi.Mode()&os.ModeSocket == os.ModeSocket {
+		continue
+	}
+
 	hdr, err := tar.FileInfoHeader(fi, link)
 	if err != nil {
 		return fmt.Errorf("failed to create tar info header: %s", err)


More information about the lxc-devel mailing list