Skip to content

Commit

Permalink
Fix ReceiveResponse function
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Meis <christopher.meis@9elements.com>
  • Loading branch information
ChriMarMe committed Dec 8, 2021
1 parent acedce6 commit 4b3bfd0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/ipmi/dev.go
Expand Up @@ -6,7 +6,6 @@ package ipmi

import (
"fmt"
"log"
"os"
"runtime"
"unsafe"
Expand All @@ -24,7 +23,7 @@ func (d *Dev) SendRequest(req *request) error {
_, _, err := d.syscall(unix.SYS_IOCTL, d.File.Fd(), _IPMICTL_SEND_COMMAND, uintptr(unsafe.Pointer(req)))
runtime.KeepAlive(req)
if err != 0 {
return fmt.Errorf("syscall failed with: %v", err.Error())
return fmt.Errorf("syscall failed with: %v", err)
}
return nil
}
Expand All @@ -43,7 +42,7 @@ func (d *Dev) ReceiveResponse(msgID int64, resp *response, buf []byte) ([]byte,
}

if resp.msgid != msgID {
log.Printf("Received wrong message. Trying again.")
rerr = fmt.Errorf("received wrong message")
return false
}

Expand All @@ -67,7 +66,7 @@ func (d *Dev) ReceiveResponse(msgID int64, resp *response, buf []byte) ([]byte,
return nil, fmt.Errorf("failed to set read deadline: %v", err)
}
if err := d.connRead(readMsg, conn); err != nil {
return nil, fmt.Errorf("failed to read rawconn: %v", err)
return nil, fmt.Errorf("failed to read rawconn: %v", rerr)
}

return result, rerr
Expand Down

0 comments on commit 4b3bfd0

Please sign in to comment.