summaryrefslogtreecommitdiff
path: root/cmd/podman/system/service_abi.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-06-15 13:48:47 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-06-15 14:33:14 +0200
commit20b3fbe6d6d085c24de9aa0637509ee69e30ee54 (patch)
treecc12cfa1e5dee85cee1cdd8b16bbdb212a3fba03 /cmd/podman/system/service_abi.go
parentcab97798bfe8fecd597693255f5a054bd5b7d459 (diff)
downloadpodman-20b3fbe6d6d085c24de9aa0637509ee69e30ee54.tar.gz
podman-20b3fbe6d6d085c24de9aa0637509ee69e30ee54.tar.bz2
podman-20b3fbe6d6d085c24de9aa0637509ee69e30ee54.zip
systemd socker activation: check listener to prevent panic
Commit 5fa6f686db added a regression which was fixed in eb71712626f9. Apply the same fix again to prevent a panic and return a proper error instead. To not regress again I added a e2e test which makes sure we do not panic. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/system/service_abi.go')
-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)