diff options
Diffstat (limited to 'src/libs/installer/remoteclient.cpp')
-rw-r--r-- | src/libs/installer/remoteclient.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libs/installer/remoteclient.cpp b/src/libs/installer/remoteclient.cpp index e208620cb..ad1e5ecf6 100644 --- a/src/libs/installer/remoteclient.cpp +++ b/src/libs/installer/remoteclient.cpp @@ -29,6 +29,8 @@ #include "remoteclient.h" #include "remoteclient_p.h" +#include <QDir> + namespace QInstaller { RemoteClient *RemoteClient::s_instance = nullptr; @@ -61,6 +63,18 @@ QString RemoteClient::authorizationKey() const return d->m_key; } +QString RemoteClient::socketPathName(const QString &socketName) const +{ + QString socketPathName; + if (socketName.startsWith(QLatin1Char('/'))) { + socketPathName = socketName; + } else { + socketPathName = QDir::tempPath(); + socketPathName += QLatin1Char('/') + socketName; + } + return socketPathName; +} + /*! Initializes the client with \a socketName, with the \a key the client sends to authenticate with the server, \a mode and \a startAs. @@ -69,7 +83,17 @@ void RemoteClient::init(const QString &socketName, const QString &key, Protocol: Protocol::StartAs startAs) { Q_D(RemoteClient); + + // Since Qt 5.12.0, we should determince the full socket path on Unix + // platforms before calling QLocalSocketPrivate::_q_connectToSocket(). + // Otherwise the new canonical implementation of QDir::tempPath() + // presents unintended usage of RemoteFileEngine. + +#if QT_VERSION >= QT_VERSION_CHECK(5,12,0) && defined(Q_OS_UNIX) + d->init(socketPathName(socketName), key, mode, startAs); +#else d->init(socketName, key, mode, startAs); +#endif } void RemoteClient::setAuthorizationFallbackDisabled(bool disabled) |