Skip to content

Commit

Permalink
[messagingframework] Move socket path. Fixes JB#53879 OMP#JOLLA-19
Browse files Browse the repository at this point in the history
Sockets should be located in subdirectory of runtime directory instead
of /tmp.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Apr 15, 2021
1 parent 6268432 commit b856880
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
69 changes: 69 additions & 0 deletions rpm/0031-Store-socket-in-RuntimeLocation.patch
@@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= <tomi.leppanen@jolla.com>
Date: Mon, 12 Apr 2021 17:09:15 +0300
Subject: [PATCH] Store socket in RuntimeLocation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
---
src/libraries/qmfclient/support/qcopchannel.cpp | 5 +++--
src/libraries/qmfclient/support/qcopserver.cpp | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/libraries/qmfclient/support/qcopchannel.cpp b/src/libraries/qmfclient/support/qcopchannel.cpp
index 2e1d67af..e921e070 100644
--- a/src/libraries/qmfclient/support/qcopchannel.cpp
+++ b/src/libraries/qmfclient/support/qcopchannel.cpp
@@ -48,6 +48,7 @@
#include "qcoreevent.h"
#include "qmetaobject.h"
#include "qmaillog.h"
+#include "qstandardpaths.h"

QCopServerRegexp::QCopServerRegexp(const QString& ch, QCopClient *cl)
: channel(ch), client(cl)
@@ -1095,8 +1096,8 @@ void QCopClient::disconnectFromServer()

QString QCopThreadData::socketPath()
{
- //return (Qtopia::inline tempDir() + "qcop-server").toUtf8();
- return QString::fromLatin1("qcop-server-0");
+ return QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation)
+ + QStringLiteral("/messageserver/qcop-server-0");
}

#else
diff --git a/src/libraries/qmfclient/support/qcopserver.cpp b/src/libraries/qmfclient/support/qcopserver.cpp
index 39def5aa..1b212e24 100644
--- a/src/libraries/qmfclient/support/qcopserver.cpp
+++ b/src/libraries/qmfclient/support/qcopserver.cpp
@@ -37,6 +37,7 @@
#include "qcopchannelmonitor_p.h"
#include <QtCore/qfile.h>
#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>

QCopServerPrivate::QCopServerPrivate()
: QCopLocalServer()
@@ -44,6 +45,7 @@ QCopServerPrivate::QCopServerPrivate()
bool ok;
#ifndef QT_NO_QCOP_LOCAL_SOCKET
QString path = QCopThreadData::socketPath();
+ QFileInfo(path).dir().mkpath(".");
ok = listen(path);
#ifdef Q_OS_UNIX
if (!ok) {
@@ -56,7 +58,7 @@ QCopServerPrivate::QCopServerPrivate()
socket->connectToServer(path);
if (!socket->waitForConnected()) {
delete socket;
- QFile::remove(QDir::tempPath() + QChar::fromLatin1('/') + path);
+ QFile::remove(path);
ok = listen(path);
} else {
delete socket;
--
2.30.2

1 change: 1 addition & 0 deletions rpm/qmf-qt5.spec
Expand Up @@ -59,6 +59,7 @@ Patch27: 0027-Allow-a-service-provided-folder-to-be-set-as-the-sta.patch
Patch28: 0028-Add-QMailMessage-CalendarCancellation-flag.patch
Patch29: 0029-Use-a-queued-connection-to-handle-accountsUpdated-si.patch
Patch30: 0030-Support-as-specifier-for-log-file-paths.patch
Patch31: 0031-Store-socket-in-RuntimeLocation.patch

%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
Expand Down

0 comments on commit b856880

Please sign in to comment.