mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
File must be sync'd before closing (#7657)
- group sync and close action into a single defer statement to avoid evaluation order related bugs in future.
This commit is contained in:
parent
55aa20595f
commit
c871456269
@ -1182,8 +1182,10 @@ func (s *posix) CreateFile(volume, path string, fileSize int64, r io.Reader) (er
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer w.Sync() // Sync before close.
|
||||
defer w.Close()
|
||||
defer func() {
|
||||
w.Sync() // Sync before close.
|
||||
w.Close()
|
||||
}()
|
||||
|
||||
var e error
|
||||
if fileSize > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user