mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
dockershim: check if f.Sync() returns an error and surface it
This commit is contained in:
parent
424819888a
commit
a850614613
@ -76,7 +76,10 @@ func writeFileAndSync(filename string, data []byte, perm os.FileMode) error {
|
||||
if err == nil && n < len(data) {
|
||||
err = io.ErrShortWrite
|
||||
}
|
||||
f.Sync()
|
||||
if err == nil {
|
||||
// Only sync if the Write completed successfully.
|
||||
err = f.Sync()
|
||||
}
|
||||
if err1 := f.Close(); err == nil {
|
||||
err = err1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user