diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/create.go | 3 | ||||
-rw-r--r-- | cmd/podman/run.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index af065817f..8f9e82805 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -159,6 +159,9 @@ func createCmd(c *cli.Context) error { } if c.String("cidfile") != "" { + if _, err := os.Stat(c.String("cidfile")); err == nil { + return errors.Errorf("container id file exists. ensure another container is not using it or delete %s", c.String("cidfile")) + } if err := libpod.WriteFile("", c.String("cidfile")); err != nil { return errors.Wrapf(err, "unable to write cidfile %s", c.String("cidfile")) } diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 53b7083e3..523b973fb 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -37,6 +37,9 @@ func runCmd(c *cli.Context) error { } if c.String("cidfile") != "" { + if _, err := os.Stat(c.String("cidfile")); err == nil { + return errors.Errorf("container id file exists. ensure another container is not using it or delete %s", c.String("cidfile")) + } if err := libpod.WriteFile("", c.String("cidfile")); err != nil { return errors.Wrapf(err, "unable to write cidfile %s", c.String("cidfile")) } |