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

10
log.go
View File

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

View File

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