summaryrefslogtreecommitdiff
path: root/cmd/podman/create_cli.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-01-09 13:23:01 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-01-10 10:27:39 -0500
commitf2ff550967660a611f8f28e9bd79d39bc007c104 (patch)
treecf3ff1cc346322d62de3c284b462adb539248152 /cmd/podman/create_cli.go
parent64627d910b2113fa2de6b949d846af379e75e305 (diff)
downloadpodman-f2ff550967660a611f8f28e9bd79d39bc007c104.tar.gz
podman-f2ff550967660a611f8f28e9bd79d39bc007c104.tar.bz2
podman-f2ff550967660a611f8f28e9bd79d39bc007c104.zip
Fix handling of nil volumes
Currently if a user passes in a -v with -v $bogus:/foobar We crash. This will throw a proper error. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/create_cli.go')
-rw-r--r--cmd/podman/create_cli.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/create_cli.go b/cmd/podman/create_cli.go
index 1a0830f2e..95b9321fd 100644
--- a/cmd/podman/create_cli.go
+++ b/cmd/podman/create_cli.go
@@ -201,6 +201,9 @@ func parseVolumesFrom(volumesFrom []string) error {
}
func validateVolumeHostDir(hostDir string) error {
+ if len(hostDir) == 0 {
+ return errors.Errorf("host directory cannot be empty")
+ }
if filepath.IsAbs(hostDir) {
if _, err := os.Stat(hostDir); err != nil {
return errors.Wrapf(err, "error checking path %q", hostDir)
@@ -212,6 +215,9 @@ func validateVolumeHostDir(hostDir string) error {
}
func validateVolumeCtrDir(ctrDir string) error {
+ if len(ctrDir) == 0 {
+ return errors.Errorf("container directory cannot be empty")
+ }
if !filepath.IsAbs(ctrDir) {
return errors.Errorf("invalid container path, must be an absolute path %q", ctrDir)
}