placing defer file.Close() right after opening it (#2306)

master
karthic rao 8 years ago committed by Harshavardhana
parent 8b3cb3a0de
commit 6b5fce826b
  1. 7
      posix.go

@ -492,6 +492,10 @@ func (s *posix) ReadFile(volume string, path string, offset int64, buf []byte) (
}
return 0, err
}
// Close the file descriptor.
defer file.Close()
st, err := file.Stat()
if err != nil {
return 0, err
@ -506,9 +510,6 @@ func (s *posix) ReadFile(volume string, path string, offset int64, buf []byte) (
return 0, err
}
// Close the reader.
defer file.Close()
// Read full until buffer.
m, err := io.ReadFull(file, buf)

Loading…
Cancel
Save