From b5d3c3874f5c7edffc66062cfa2e2d8f43ca6186 Mon Sep 17 00:00:00 2001 From: folbrich Date: Sat, 3 Aug 2019 16:32:35 -0600 Subject: [PATCH] Preserve device file mode during untar to actually create devices with mknod, not files --- untar.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/untar.go b/untar.go index 52a3e8d..7af8b8b 100644 --- a/untar.go +++ b/untar.go @@ -164,7 +164,7 @@ func makeDevice(base string, n NodeDevice, opts UntarOptions) error { if err := syscall.Unlink(dst); err != nil && !os.IsNotExist(err) { return err } - if err := syscall.Mknod(dst, 0666, int(mkdev(n.Major, n.Minor))); err != nil { + if err := syscall.Mknod(dst, uint32(n.Mode)|0666, int(mkdev(n.Major, n.Minor))); err != nil { return errors.Wrapf(err, "mknod %s", dst) } if !opts.NoSameOwner {