summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-03-17 21:49:02 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-03-18 09:37:43 +0100
commit7fee7d833cda2373977993364eac349787ee7a6d (patch)
treed549e9575599a137221943cf64917883dbb22a13
parent8aed32acea9bb35898abcee58fc9aa2a03ef264a (diff)
downloadpodman-7fee7d833cda2373977993364eac349787ee7a6d.tar.gz
podman-7fee7d833cda2373977993364eac349787ee7a6d.tar.bz2
podman-7fee7d833cda2373977993364eac349787ee7a6d.zip
pod: fix segfault when there are no arguments to inspect
Closes: https://github.com/containers/libpod/issues/2681 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--cmd/podman/pod_inspect.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go
index 79ffe2e6f..46ac30c2a 100644
--- a/cmd/podman/pod_inspect.go
+++ b/cmd/podman/pod_inspect.go
@@ -44,6 +44,11 @@ func podInspectCmd(c *cliconfig.PodInspectValues) error {
pod *adapter.Pod
)
args := c.InputArgs
+
+ if len(args) < 1 && !c.Latest {
+ return errors.Errorf("you must provide the name or id of a pod")
+ }
+
runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")