summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-21 12:55:31 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-21 13:32:20 +0200
commit13c6fd067cab2fd21f96837c6b6105ebb740fd1d (patch)
tree7db35e02f667251f6fa55ce7734610306f61a287 /cmd/podman
parent02ab86a68aa3c510dc8be8aefbd1029efb657438 (diff)
downloadpodman-13c6fd067cab2fd21f96837c6b6105ebb740fd1d.tar.gz
podman-13c6fd067cab2fd21f96837c6b6105ebb740fd1d.tar.bz2
podman-13c6fd067cab2fd21f96837c6b6105ebb740fd1d.zip
system service: remove unnecessary pointer to listner
Since the listener is already an interface there is no reason to use a extra pointer for it. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/system/service_abi.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index d6b42ed29..f8abea3aa 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -23,7 +23,7 @@ import (
func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities.ServiceOptions) error {
var (
- listener *net.Listener
+ listener net.Listener
err error
)
@@ -44,17 +44,15 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
// If it is activated by systemd, use the first LISTEN_FD (3)
// instead of opening the socket file.
f := os.NewFile(uintptr(3), "podman.sock")
- l, err := net.FileListener(f)
+ listener, err = net.FileListener(f)
if err != nil {
return err
}
- listener = &l
} else {
- l, err := net.Listen(uri.Scheme, path)
+ listener, err = net.Listen(uri.Scheme, path)
if err != nil {
return errors.Wrapf(err, "unable to create socket")
}
- listener = &l
}
case "tcp":
host := uri.Host
@@ -62,11 +60,10 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
// For backward compatibility, support "tcp:<host>:<port>" and "tcp://<host>:<port>"
host = uri.Opaque
}
- l, err := net.Listen(uri.Scheme, host)
+ listener, err = net.Listen(uri.Scheme, host)
if err != nil {
return errors.Wrapf(err, "unable to create socket %v", host)
}
- listener = &l
default:
logrus.Debugf("Attempting API Service endpoint scheme %q", uri.Scheme)
}
@@ -101,7 +98,7 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
err = server.Serve()
if listener != nil {
- _ = (*listener).Close()
+ _ = listener.Close()
}
return err
}