Skip to content

Commit

Permalink
Remove bogus fallback
Browse files Browse the repository at this point in the history
It if XDG_RUNTIME_DIR is unset, then QStandardsPaths::RuntimeLocation
returns fallback a path in /tmp. This implies that the fallback code
remove here is wrong, since the fallback to /tmp is already handled by
Qt and doesn't need to be done again on the KeePassXC side.

It's clear that nobody is relying on the existing fallback for the
extension, since the code-path that creates triggers this fallback was
unreachable.
  • Loading branch information
Hugo Osvaldo Barrera committed May 11, 2022
1 parent afe8f5b commit a455ee4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/browser/BrowserShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,15 @@ namespace BrowserShared
#if defined(KEEPASSXC_DIST_SNAP)
return QProcessEnvironment::systemEnvironment().value("SNAP_USER_COMMON") + serverName;
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Use XDG_RUNTIME_DIR if available, else use /tmp.
// This returns XDG_RUNTIME_DIR or else a temporary subdirectory.
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
if (path.isEmpty()) {
path = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
}

// Put the socket in a dedicated directory.
// This directory will be easily mountable by sandbox containers.
QString subPath = path + "/app/org.keepassxc.KeePassXC/";
QDir().mkpath(subPath);
QString socketPath = subPath + serverName;

QString socketPath = subPath + serverName;
#ifndef KEEPASSXC_DIST_FLATPAK
// Create a symlink at the legacy location for backwards compatibility.
QFile::link(socketPath, path + serverName);
Expand Down

0 comments on commit a455ee4

Please sign in to comment.