Skip to content

Commit c4691b5

Browse files
authored
Merge pull request arduino#255 from arduino/permissions
Set correct permissions when downloading tool [WE-44]
2 parents a064c29 + bb2007c commit c4691b5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/download.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ func extractTarGz(body []byte, location string) (string, error) {
423423
info := header.FileInfo()
424424

425425
// Create parent folder
426-
if err = os.MkdirAll(filepath.Dir(path), info.Mode()); err != nil {
426+
dirmode := info.Mode() | os.ModeDir | 0700
427+
if err = os.MkdirAll(filepath.Dir(path), dirmode); err != nil {
427428
return location, err
428429
}
429430

@@ -514,6 +515,12 @@ func extractBz2(body []byte, location string) (string, error) {
514515
path := filepath.Join(location, strings.Replace(header.Name, basedir, "", -1))
515516
info := header.FileInfo()
516517

518+
// Create parent folder
519+
dirmode := info.Mode() | os.ModeDir | 0700
520+
if err = os.MkdirAll(filepath.Dir(path), dirmode); err != nil {
521+
return location, err
522+
}
523+
517524
if info.IsDir() {
518525
if err = os.MkdirAll(path, info.Mode()); err != nil {
519526
return location, err

0 commit comments

Comments
 (0)