From 3bf594e262f4f0dc2a50b867ea3eaac1152cf078 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Thu, 31 Oct 2019 14:15:55 -0700 Subject: Refactor test to prevent panic Signed-off-by: Jhon Honce --- cmd/podman/utils.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmd/podman') diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go index 592d7a1d1..c19e6391e 100644 --- a/cmd/podman/utils.go +++ b/cmd/podman/utils.go @@ -68,7 +68,8 @@ func aliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName { // Check if a file exists and is not a directory func checkIfFileExists(name string) bool { file, err := os.Stat(name) - if os.IsNotExist(err) { + // All errors return file == nil + if err != nil { return false } return !file.IsDir() -- cgit v1.2.3-54-g00ecf