Skip to content

Commit

Permalink
Merge pull request #71 from ferhatelmas/defer-err
Browse files Browse the repository at this point in the history
Defer after checking error
  • Loading branch information
x4m committed Feb 19, 2018
2 parents c372315 + b7166bd commit 99d4bdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,10 @@ func HandleWALFetch(pre *Prefix, walFileName string, location string, triggerPre

func checkWALFileMagic(prefetched string) error {
file, err := os.Open(prefetched)
defer file.Close()
if err != nil {
return err
}
defer file.Close()
magic := make([]byte, 4)
file.Read(magic)
if binary.LittleEndian.Uint32(magic) < 0xD061 {
Expand Down

0 comments on commit 99d4bdf

Please sign in to comment.