diff options
Diffstat (limited to 'util/network.go')
-rw-r--r-- | util/network.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/util/network.go b/util/network.go index 70e38fdb..3f533023 100644 --- a/util/network.go +++ b/util/network.go @@ -2,6 +2,7 @@ package util import ( "errors" + "fmt" "net" "strings" "syscall" @@ -11,15 +12,18 @@ import ( func CreateListener(address string) (net.Listener, error) { dsn := strings.Split(address, "://") if len(dsn) != 2 { - return nil, errors.New("Invalid DSN (tcp://:6001, unix://file.sock)") + return nil, errors.New("invalid DSN (tcp://:6001, unix://file.sock)") } if dsn[0] != "unix" && dsn[0] != "tcp" { - return nil, errors.New("Invalid Protocol (tcp://:6001, unix://file.sock)") + return nil, errors.New("invalid Protocol (tcp://:6001, unix://file.sock)") } if dsn[0] == "unix" { - syscall.Unlink(dsn[1]) + err := syscall.Unlink(dsn[1]) + if err != nil { + return nil, fmt.Errorf("error during the unlink syscall: error %v", err) + } } return net.Listen(dsn[0], dsn[1]) |