[lxc-devel] [distrobuilder/master] chroot: Fix mode for special files in /dev
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Tue Mar 3 20:28:10 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200303/f312fe2f/attachment.bin>
-------------- next part --------------
From b6edc52561ec20b7a1679e83de700bdd6a2a7b2e Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 3 Mar 2020 21:27:25 +0100
Subject: [PATCH] chroot: Fix mode for special files in /dev
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
shared/chroot.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/shared/chroot.go b/shared/chroot.go
index 2e75b69..6002426 100644
--- a/shared/chroot.go
+++ b/shared/chroot.go
@@ -363,6 +363,13 @@ func populateDev() error {
if err != nil {
return errors.Wrapf(err, "Failed to create %q", d.Path)
}
+
+ // For some odd reason, unix.Mknod will not set the mode correctly.
+ // This fixes that.
+ err = unix.Chmod(d.Path, d.Mode)
+ if err != nil {
+ return errors.Wrapf(err, "Failed to chmod %q", d.Path)
+ }
}
symlinks := []struct {
More information about the lxc-devel
mailing list