[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Qt patch: Redo select on EINTR "error" (QLocalSocket)
From:       Thiago Macieira <thiago () kde ! org>
Date:       2008-11-10 6:15:04
Message-ID: 200811100715.07511.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Daniel Winter wrote:
>Can someone please take a look at the patch ( I think it ?is not really
>optimal as it is, but it fixes the issue with Soprano )? ?What needs to
> be done to get it in the qt-copy patch set?

This was already fixed for Qt 4.4.4. See Qt task 226687.

Attaching the official patch instead. Feel free to add it to qt-copy.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["qnativesocketengine-select.diff" (text/plain)]

diff --git a/src/network/socket/qnativesocketengine_unix.cpp \
b/src/network/socket/qnativesocketengine_unix.cpp index 52584c2..c89f189 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -838,10 +838,15 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool \
selectForRead) co  tv.tv_sec = timeout / 1000;
     tv.tv_usec = (timeout % 1000) * 1000;

-    if (selectForRead)
-        return select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
-    else
-        return select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
+    int retval;
+    do {
+        if (selectForRead)
+            retval = select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : \
&tv); +        else
+            retval = select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : \
&tv); +    } while (retval == -1 && errno == EINTR);
+
+    return retval;
 }

 int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool \
checkWrite, @@ -861,7 +866,10 @@ int QNativeSocketEnginePrivate::nativeSelect(int \
timeout, bool checkRead, bool c  tv.tv_sec = timeout / 1000;
     tv.tv_usec = (timeout % 1000) * 1000;

-    int ret = select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : \
&tv); +    int ret;
+    do {
+        ret = select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : \
&tv); +    } while (ret == -1 && errno == EINTR);
     if (ret <= 0)
         return ret;


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic