Merge pull request #340 from harshavardhana/pr_out_make_sure_we_use_o_excl_with_o_create_to_make_sure_we_don_t_trip_over_existing_file

This commit is contained in:
Harshavardhana 2015-03-22 15:56:31 -07:00
commit 562a57be84

View File

@ -8,7 +8,7 @@ import (
)
func newDonutFileWriter(objectDir string) (Writer, error) {
dataFile, err := os.OpenFile(path.Join(objectDir, "data"), os.O_WRONLY|os.O_CREATE, 0600)
dataFile, err := os.OpenFile(path.Join(objectDir, "data"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC|os.O_EXCL, 0600)
if err != nil {
return nil, err
}