diff options
author | Ben Burwell <ben@benburwell.com> | 2019-08-13 14:38:31 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-08-13 14:38:31 -0400 |
commit | 3fa3887c342393b25e2df48f4c096cbf31ce2d5f (patch) | |
tree | 5694d77f58c1e05fd369c9fd1b949fb2f204653c /apply.go | |
parent | e083b1b1558dc1e97da361c505653a38bd339cef (diff) |
Preserve file mode on adopt/apply
Diffstat (limited to 'apply.go')
-rw-r--r-- | apply.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -42,7 +42,11 @@ func applyFile(name string) error { if err = os.MkdirAll(filepath.Dir(d), 0700); err != nil { return err } - out, err := os.OpenFile(d, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) + srcInfo, err := os.Stat(src) + if err != nil { + return err + } + out, err := os.OpenFile(d, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, srcInfo.Mode()) if err != nil { return err } |