summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qlocalsocket_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket/qlocalsocket_unix.cpp')
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 77c5028fb3..bb0f11f038 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -268,15 +268,16 @@ void QLocalSocketPrivate::_q_connectToSocket()
connectingPathName += QLatin1Char('/') + connectingName;
}
+ const QByteArray encodedConnectingPathName = QFile::encodeName(connectingPathName);
struct sockaddr_un name;
name.sun_family = PF_UNIX;
- if (sizeof(name.sun_path) < (uint)connectingPathName.toLatin1().size() + 1) {
+ if (sizeof(name.sun_path) < (uint)encodedConnectingPathName.size() + 1) {
QString function = QLatin1String("QLocalSocket::connectToServer");
errorOccurred(QLocalSocket::ServerNotFoundError, function);
return;
}
- ::memcpy(name.sun_path, connectingPathName.toLatin1().data(),
- connectingPathName.toLatin1().size() + 1);
+ ::memcpy(name.sun_path, encodedConnectingPathName.constData(),
+ encodedConnectingPathName.size() + 1);
if (-1 == qt_safe_connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) {
QString function = QLatin1String("QLocalSocket::connectToServer");
switch (errno)