summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@trolltech.com>2009-04-16 13:14:09 (GMT)
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-04-16 14:12:38 (GMT)
commitb43b57b251505157f32463094a9ac7c41ab69859 (patch)
treec258c768964902c64516dd3b12588cb909acb7dc /src/network
parent5c359a9b599e2024d070534c10c5a0e224eca5d8 (diff)
downloadQt-b43b57b251505157f32463094a9ac7c41ab69859.zip
Qt-b43b57b251505157f32463094a9ac7c41ab69859.tar.gz
Qt-b43b57b251505157f32463094a9ac7c41ab69859.tar.bz2
fix reading problem on 64-bit machines in QProcess and socket engine
QProcessPrivate and QNativeSocketEnginePrivate were reporting a wrong number of bytes available on 64-bit machines, due to use of size_t in ioctl. That was required by Irix, which we dropped support for, so we can also drop size_t Reviewed-by: Thiago Task-number: 249537
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 73f6f84..cc372a6 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -506,26 +506,11 @@ int QNativeSocketEnginePrivate::nativeAccept()
qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
{
- /*
- Apparently, there is not consistency among different operating
- systems on how to use FIONREAD.
-
- FreeBSD, Linux and Solaris all expect the 3rd argument to
- ioctl() to be an int, which is normally 32-bit even on 64-bit
- machines.
-
- IRIX, on the other hand, expects a size_t, which is 64-bit on
- 64-bit machines.
-
- So, the solution is to use size_t initialized to zero to make
- sure all bits are set to zero, preventing underflow with the
- FreeBSD/Linux/Solaris ioctls.
- */
- size_t nbytes = 0;
+ int nbytes = 0;
// gives shorter than true amounts on Unix domain sockets.
qint64 available = 0;
if (::ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0)
- available = (qint64) *((int *) &nbytes);
+ available = (qint64) nbytes;
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeBytesAvailable() == %lli", available);