Skip to content

Commit

Permalink
fix history rewrite fd close
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Oct 8, 2015
1 parent 9f55547 commit aec0cc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion history.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func (o *opHistory) HistoryRewrite() {
if err != nil {
return
}
defer fd.Close()

buf := bufio.NewWriter(fd)
for elem := o.history.Front(); elem != nil; elem = elem.Next() {
Expand All @@ -90,6 +89,7 @@ func (o *opHistory) HistoryRewrite() {

// replace history file
if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
fd.Close()
return
}

Expand Down

0 comments on commit aec0cc0

Please sign in to comment.