summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2014-10-28 13:53:14 +0200
committerBogDan Vatra <bogdan@kde.org>2014-10-28 21:30:18 +0100
commit320360131559df76ba1f635b665659f57e147665 (patch)
tree62858adf04657f7c90e39543ab10bc43de73bd07 /src/network
parent23553cccdaf42189fe2390f9b8082828fb1a5237 (diff)
Fix QLocalServer, create a temp path as small as possible.
If requestedServerName is a full path e.g. "/tmp/some/long/path" the temp path will end up "/tmp/some/long/path.balblabla/tmp/some/long/path" and it might fail because it doesn't fit in addr.sun_path. Change-Id: I6a138fd92be9e0b3b432ab9ac977d04cb330f3fd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qlocalserver_unix.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index 313fe4ad29..a615dcc7b6 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -90,13 +90,14 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
// Check any of the flags
if (socketOptions & QLocalServer::WorldAccessOption) {
- tempDir.reset(new QTemporaryDir(fullServerName));
+ QFileInfo serverNameFileInfo(fullServerName);
+ tempDir.reset(new QTemporaryDir(serverNameFileInfo.absolutePath() + QLatin1Char('/')));
if (!tempDir->isValid()) {
setError(QLatin1String("QLocalServer::listen"));
return false;
}
tempPath = tempDir->path();
- tempPath += QLatin1Char('/') + requestedServerName;
+ tempPath += QLatin1String("/s");
}
// create the unix socket