Hard code file mode on disk write to 0644 which is what we would expect

This commit is contained in:
KemoNine 2020-09-20 19:28:48 -04:00
parent 0579b3e97d
commit 0c9bfd6a7c

View file

@ -7,11 +7,7 @@ import (
) )
func WriteFile(destinationPath string, tempPath string, dataForDisk []byte) { func WriteFile(destinationPath string, tempPath string, dataForDisk []byte) {
existingStat, err := os.Lstat(destinationPath) if err := ioutil.WriteFile(tempPath, dataForDisk, 0644); err != nil {
if err != nil {
log.Fatalf("Error checking if file exists : %s", err)
}
if err := ioutil.WriteFile(tempPath, dataForDisk, existingStat.Mode()); err != nil {
log.Fatalf("Error writing temp file : %s", err) log.Fatalf("Error writing temp file : %s", err)
} }
if err := os.Rename(tempPath, destinationPath); err != nil { if err := os.Rename(tempPath, destinationPath); err != nil {