diff options
author | Ben Burwell <ben@benburwell.com> | 2019-08-13 13:08:23 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-08-13 13:08:23 -0400 |
commit | 2fde66440ea282532bb1a8e0380e32d331302e39 (patch) | |
tree | 8ba7cad6de673a60493f9b87db3a489ded66821b | |
parent | b8dd7dae42e783f2236f889d276e66bedb182837 (diff) |
truncate files when writing
-rw-r--r-- | adopt.go | 2 | ||||
-rw-r--r-- | apply.go | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -30,7 +30,7 @@ func adoptFile(name string) error { return err } defer from.Close() - to, err := os.OpenFile(toPath, os.O_CREATE|os.O_WRONLY, 0600) + to, err := os.OpenFile(toPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) if err != nil { return err } @@ -42,7 +42,7 @@ 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, 0600) + out, err := os.OpenFile(d, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) if err != nil { return err } |