diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index 5a55dfb88..03cc28456 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -135,7 +135,8 @@ func StartGateway(ctx *cli.Context, gw Gateway) { handleCommonCmdArgs(ctx) // Get port to listen on from gateway address - _, gatewayPort, pErr := net.SplitHostPort(gatewayAddr) + var pErr error + _, globalMinioPort, pErr = net.SplitHostPort(gatewayAddr) if pErr != nil { logger.FatalIf(pErr, "Unable to start gateway") } @@ -144,7 +145,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) { // to IPv6 address ie minio will start listening on IPv6 address whereas another // (non-)minio process is listening on IPv4 of given port. // To avoid this error situation we check for port availability. - logger.FatalIf(checkPortAvailability(gatewayPort), "Unable to start the gateway") + logger.FatalIf(checkPortAvailability(globalMinioPort), "Unable to start the gateway") // Create certs path. logger.FatalIf(createConfigDir(), "Unable to create configuration directories")