Skip to content

Commit

Permalink
close files after opening them! :(
Browse files Browse the repository at this point in the history
  • Loading branch information
asimihsan committed Feb 19, 2016
1 parent 941f43a commit b84e5f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arq/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func IsValidPackFile(cacheFilepath string) (bool, error) {
log.Debugln("IsValidPackFile: some error while opening file: ", err)
return false, err
}

defer f.Close()
hasher := sha1.New()
if _, err := io.CopyN(hasher, f, size - 20); err != nil {
log.Debugln("IsValidPackFile: error whilst reading pack file: ", err)
Expand Down
1 change: 1 addition & 0 deletions arq/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func getWriterForFile(destinationPath string, mode os.FileMode, size int64) (*os
log.Errorf("getWriterForFile failed to open destinationPath %s: %s", destinationPath, err)
return nil, nil, err
}
defer f.Close()
log.Debugf("getWriterForFile is writing to: %s", destinationPath)
err = f.Truncate(int64(size))
if err != nil {
Expand Down

0 comments on commit b84e5f6

Please sign in to comment.