aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/host_linux.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-08-01 13:19:54 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-02 16:57:31 +0200
commitc67a9331a4f7c25df943ff821c9c6ed8013df869 (patch)
treee380eb862ba4e10896ad0d31442bd2f2c4928c0e /pkg/host/host_linux.go
parent0a7cf4ec6374315af969a5bad7532095a1962492 (diff)
gometalinter: clean up some errcheck warnings
Check some errors where relevant. Unfortunately enabling errcheck does not look feasible, too many warnings. Update #538
Diffstat (limited to 'pkg/host/host_linux.go')
-rw-r--r--pkg/host/host_linux.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkg/host/host_linux.go b/pkg/host/host_linux.go
index 38b2461f1..6d7c9c516 100644
--- a/pkg/host/host_linux.go
+++ b/pkg/host/host_linux.go
@@ -337,8 +337,8 @@ func checkCoverage() string {
return ""
}
-func checkComparisons() string {
- if reason := checkDebugFS(); reason != "" {
+func checkComparisons() (reason string) {
+ if reason = checkDebugFS(); reason != "" {
return reason
}
// TODO(dvyukov): this should run under target arch.
@@ -365,7 +365,11 @@ func checkComparisons() string {
if err != nil {
return fmt.Sprintf("KCOV mmap failed: %v", err)
}
- defer syscall.Munmap(mem)
+ defer func() {
+ if err := syscall.Munmap(mem); err != nil {
+ reason = fmt.Sprintf("munmap failed: %v", err)
+ }
+ }()
_, _, errno = syscall.Syscall(syscall.SYS_IOCTL,
uintptr(fd), linux.KCOV_ENABLE, linux.KCOV_TRACE_CMP)
if errno != 0 {
@@ -374,7 +378,12 @@ func checkComparisons() string {
}
return fmt.Sprintf("ioctl(KCOV_TRACE_CMP) failed: %v", errno)
}
- defer syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), linux.KCOV_DISABLE, 0)
+ defer func() {
+ _, _, errno = syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), linux.KCOV_DISABLE, 0)
+ if errno != 0 {
+ reason = fmt.Sprintf("ioctl(KCOV_DISABLE) failed: %v", errno)
+ }
+ }()
return ""
}