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>
This commit is contained in:
parent
23553cccda
commit
3203601315
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user