Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 8989c69

Browse files
committed
drop umask to 0 when writing files to disk
1 parent d6c17e0 commit 8989c69

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/util/tar_utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ import (
2222
"os"
2323
"path/filepath"
2424
"strings"
25+
"syscall"
2526

2627
"github.com/sirupsen/logrus"
2728
)
2829

2930
func unpackTar(tr *tar.Reader, path string) error {
31+
// drop the umask temporarily to 0, so we can create all files with correct permissions
32+
// otherwise the default (022) will cause file permission inconsistencies
33+
oldMask := syscall.Umask(0)
34+
defer syscall.Umask(oldMask)
3035
for {
3136
header, err := tr.Next()
3237
if err == io.EOF {

0 commit comments

Comments
 (0)