set file permissions at creation

cc #726
This commit is contained in:
Gokcehan committed 2022-01-26 16:52:40 +03:00
1 parent 930364ce78
commit 94e06201f9
5 files changed
+13 -23

No files matched your search

+1 -6
View File
@@ -41,7 +41,7 @@ func copyFile(src, dst string, info os.FileInfo, nums chan int64) error {
}
defer r.Close()
w, err := os.Create(dst)
w, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
if err != nil {
return err
}
@@ -70,11 +70,6 @@ func copyFile(src, dst string, info os.FileInfo, nums chan int64) error {
return err
}
if err := os.Chmod(dst, info.Mode()); err != nil {
os.Remove(dst)
return err
}
return nil
}