diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-10-29 16:25:05 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2020-10-29 16:46:27 +0100 |
commit | 12647ae33f1ac1c8b41f7dac8574667140c56c20 (patch) | |
tree | bf965b84044cd21eaf15d49d369170d8da6f5220 /cmd/podman/system | |
parent | fdd32604cf75fc310afca209adad15b1bcecfef7 (diff) | |
download | podman-12647ae33f1ac1c8b41f7dac8574667140c56c20.tar.gz podman-12647ae33f1ac1c8b41f7dac8574667140c56c20.tar.bz2 podman-12647ae33f1ac1c8b41f7dac8574667140c56c20.zip |
Create the default root API address path
Fixes #8184
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'cmd/podman/system')
-rw-r--r-- | cmd/podman/system/service.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go index 2a2b1984f..0476c632d 100644 --- a/cmd/podman/system/service.go +++ b/cmd/podman/system/service.go @@ -131,20 +131,17 @@ func resolveAPIURI(_url []string) (string, error) { if srvArgs.Varlink { socketName = "io.podman" } - socketDir := filepath.Join(xdg, "podman", socketName) - if _, err := os.Stat(filepath.Dir(socketDir)); err != nil { - if os.IsNotExist(err) { - if err := os.Mkdir(filepath.Dir(socketDir), 0755); err != nil { - return "", err - } - } else { - return "", err - } + socketPath := filepath.Join(xdg, "podman", socketName) + if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil { + return "", err } - return "unix:" + socketDir, nil + return "unix:" + socketPath, nil case srvArgs.Varlink: return registry.DefaultVarlinkAddress, nil default: + if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil { + return "", err + } return registry.DefaultRootAPIAddress, nil } } |