aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-03-12 22:12:03 +0100
committerRon Evans <[email protected]>2022-03-12 23:20:38 +0100
commit7d4bf09b1a9f7f268a0bfaed55bf98ebe827bde7 (patch)
tree66fb2fc55a2315eaf3e1749d6f31d0ba59fbdb19 /builder
parent320f21524ec3ab884372dc6ca4e1ce6356ad9302 (diff)
downloadtinygo-7d4bf09b1a9f7f268a0bfaed55bf98ebe827bde7.tar.gz
tinygo-7d4bf09b1a9f7f268a0bfaed55bf98ebe827bde7.zip
builder: use correct permission bits when creating a library
Previously, the wrong permission bits were emitted by `tinygo build-library`. This commit fixes that, by `chmod`'ing to reasonable default permission bits.
Diffstat (limited to 'builder')
-rw-r--r--builder/library.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/builder/library.go b/builder/library.go
index bebf1cd1b..c3704a1e5 100644
--- a/builder/library.go
+++ b/builder/library.go
@@ -103,6 +103,10 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
if err != nil {
return nil, nil, err
}
+ err = os.Chmod(temporaryHeaderPath, 0o755) // TempDir uses 0o700 by default
+ if err != nil {
+ return nil, nil, err
+ }
err = os.Rename(temporaryHeaderPath, headerPath)
if err != nil {
switch {
@@ -182,6 +186,10 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
if err != nil {
return err
}
+ err = os.Chmod(f.Name(), 0o644) // TempFile uses 0o600 by default
+ if err != nil {
+ return err
+ }
// Store this archive in the cache.
return os.Rename(f.Name(), archiveFilePath)
},