Eval symlinks on XDG_RUNTIME_DIR

Partial Fix for https://github.com/containers/podman/issues/14606

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2022-09-23 13:49:44 -04:00
parent f21847917e
commit 71f0c9f33a
5 changed files with 37 additions and 2 deletions

View File

@ -105,6 +105,10 @@ func setXdgDirs() error {
if _, found := os.LookupEnv("DBUS_SESSION_BUS_ADDRESS"); !found {
sessionAddr := filepath.Join(os.Getenv("XDG_RUNTIME_DIR"), "bus")
if _, err := os.Stat(sessionAddr); err == nil {
sessionAddr, err = filepath.EvalSymlinks(sessionAddr)
if err != nil {
return err
}
os.Setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path="+sessionAddr)
}
}