From 623001c4033f6d3acba08c9a30789546d4d93e90 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 29 Feb 2024 17:16:30 +0300 Subject: [PATCH] [#325] Close listener on error Signed-off-by: Denis Kirillov --- cmd/s3-gw/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/s3-gw/server.go b/cmd/s3-gw/server.go index c5852d86..f8a20d9f 100644 --- a/cmd/s3-gw/server.go +++ b/cmd/s3-gw/server.go @@ -68,7 +68,8 @@ func newServer(ctx context.Context, serverInfo ServerInfo) (*server, error) { if serverInfo.TLS.Enabled { if err = tlsProvider.UpdateCert(serverInfo.TLS.CertFile, serverInfo.TLS.KeyFile); err != nil { - return nil, fmt.Errorf("failed to update cert: %w", err) + lnErr := ln.Close() + return nil, fmt.Errorf("failed to update cert (listener close: %v): %w", lnErr, err) } ln = tls.NewListener(ln, &tls.Config{