fix a logic error in log open

pull/820/head
Xiang Li 2013-07-24 17:21:30 -07:00
parent 7411d38154
commit b01e3e713e
2 changed files with 6 additions and 6 deletions

6
log.go
View File

@ -171,13 +171,13 @@ func (l *Log) open(path string) error {
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {
debugln("open.log.append: finish ") debugln("open.log.append: finish ")
break } else {
}
if err = os.Truncate(path, readBytes); err != nil { if err = os.Truncate(path, readBytes); err != nil {
return fmt.Errorf("raft.Log: Unable to recover: %v", err) return fmt.Errorf("raft.Log: Unable to recover: %v", err)
} }
} }
break
}
// Append entry. // Append entry.
l.entries = append(l.entries, entry) l.entries = append(l.entries, entry)

View File

@ -86,7 +86,7 @@ func (e *LogEntry) decode(r io.Reader) (int, error) {
} }
data := make([]byte, length) data := make([]byte, length)
num, err := r.Read(data) _, err = r.Read(data)
if err != nil { if err != nil {
panic(err) panic(err)