summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-06-15 09:52:38 -0600
committerGitHub <noreply@github.com>2022-06-15 09:52:38 -0600
commit08f35dab5a1dc961992430373415492cf7c1963a (patch)
tree3212f43ec20d00062401f0bf47b3325b4b1a8a3b /cmd/podman
parentcab97798bfe8fecd597693255f5a054bd5b7d459 (diff)
parent90a669594a7de7061e8546b4598930be8dea08ee (diff)
downloadpodman-08f35dab5a1dc961992430373415492cf7c1963a.tar.gz
podman-08f35dab5a1dc961992430373415492cf7c1963a.tar.bz2
podman-08f35dab5a1dc961992430373415492cf7c1963a.zip
Merge pull request #14598 from Luap99/service-systemd-fd
systemd socket activation: check listener to prevent panic
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/system/service_abi.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 9dc9de1c8..7cb1b8084 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -46,6 +46,10 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
return fmt.Errorf("wrong number of file descriptors for socket activation protocol (%d != 1)", len(listeners))
}
listener = listeners[0]
+ // note that activation.Listeners() returns nil when it cannot listen on the fd (i.e. udp connection)
+ if listener == nil {
+ return fmt.Errorf("unexpected fd received from systemd: cannot listen on it")
+ }
libpodRuntime.SetRemoteURI(listeners[0].Addr().String())
} else {
uri, err := url.Parse(opts.URI)