Ignore:
Timestamp:
Jun 22, 2010, 1:13:59 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

network/os2: QLocalServer/QLocalSocket: Make sure the socket path name always starts with "\socket\" (fixes #166) [based on patch by rudi].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/network/socket/qlocalsocket_os2.cpp

    r754 r755  
    271271    QString connectingPathName;
    272272
     273
     274
     275
    273276    // determine the full server path
    274     if (connectingName.startsWith(QLatin1Char('/'))) {
    275         connectingPathName = connectingName;
    276     } else {
    277         connectingPathName = QDir::tempPath();
    278         connectingPathName += QLatin1Char('/') + connectingName;
     277    connectingPathName = QDir::toNativeSeparators(connectingName);
     278    if (!connectingName.startsWith(socketPath)) {
     279        connectingPathName = socketPath + connectingName;
    279280    }
    280281
    281282    struct sockaddr_un name;
    282283    name.sun_family = PF_UNIX;
    283     if (sizeof(name.sun_path) < (uint)connectingPathName.toLatin1().size() + 1) {
     284    name.sun_len = sizeof(sockaddr_un);
     285    QByteArray cpn = connectingPathName.toLocal8Bit();
     286    if (sizeof(name.sun_path) < (uint)cpn.size() + 1) {
    284287        QString function = QLatin1String("QLocalSocket::connectToServer");
    285288        errorOccurred(QLocalSocket::ServerNotFoundError, function);
    286289        return;
    287290    }
    288     ::memcpy(name.sun_path, connectingPathName.toLatin1().data(),
    289              connectingPathName.toLatin1().size() + 1);
     291    ::
     292
    290293    if (-1 == ::connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) {
    291294        QString function = QLatin1String("QLocalSocket::connectToServer");
Note: See TracChangeset for help on using the changeset viewer.