Commit a8506146 authored by Yu-Ju Hong's avatar Yu-Ju Hong

dockershim: check if f.Sync() returns an error and surface it

parent 42481988
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment