From dd41c21021c581ae1def106b36377d55d2ee929e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 1 Jul 2016 15:33:01 +0100 Subject: [PATCH] diagnostics: Only log connection failure if not EAFNOTSUPPORT EAFNOTSUPPORT likely means we are running on a hypervisor which doesn't support that particular socket type. Signed-off-by: Ian Campbell --- alpine/packages/diagnostics/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/alpine/packages/diagnostics/main.go b/alpine/packages/diagnostics/main.go index c62d89ac1..1e7f42747 100644 --- a/alpine/packages/diagnostics/main.go +++ b/alpine/packages/diagnostics/main.go @@ -12,6 +12,7 @@ import ( "path" "path/filepath" "strings" + "syscall" "time" "github.com/rneugeba/virtsock/go/hvsock" @@ -144,14 +145,18 @@ func main() { } vsock, err := vsock.Listen(uint(62374)) if err != nil { - log.Printf("Failed to bind to vsock port 62374: %s", err) + if errno, ok := err.(syscall.Errno); !ok || errno != syscall.EAFNOSUPPORT { + log.Printf("Failed to bind to vsock port 62374: %s", err) + } } else { listeners = append(listeners, vsock) } svcid, _ := hvsock.GuidFromString("445BA2CB-E69B-4912-8B42-D7F494D007EA") hvsock, err := hvsock.Listen(hvsock.HypervAddr{VmId: hvsock.GUID_WILDCARD, ServiceId: svcid}) if err != nil { - log.Printf("Failed to bind to hvsock port: %s", err) + if errno, ok := err.(syscall.Errno); !ok || errno != syscall.EAFNOSUPPORT { + log.Printf("Failed to bind to hvsock port: %s", err) + } } else { listeners = append(listeners, hvsock) }