diff options
Diffstat (limited to 'src/network/socket/qnativesocketengine_unix.cpp')
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 476bc69f90..3f6b6b556c 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -98,27 +98,6 @@ static QByteArray qt_prettyDebug(const char *data, int len, int maxSize) } #endif -static void qt_ignore_sigpipe() -{ -#ifndef Q_NO_POSIX_SIGNALS - // Set to ignore SIGPIPE once only. - static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0); - if (!atom.load()) { - // More than one thread could turn off SIGPIPE at the same time - // But that's acceptable because they all would be doing the same - // action - struct sigaction noaction; - memset(&noaction, 0, sizeof(noaction)); - noaction.sa_handler = SIG_IGN; - ::sigaction(SIGPIPE, &noaction, 0); - atom.store(1); - } -#else - // Posix signals are not supported by the underlying platform - // so we don't need to ignore sigpipe signal explicitly -#endif -} - /* Extracts the port and address from a sockaddr, and stores them in \a port and \a addr if they are non-null. @@ -900,8 +879,6 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; } - // ignore the SIGPIPE signal - qt_ignore_sigpipe(); ssize_t sentBytes = qt_safe_sendto(socketDescriptor, data, len, 0, sockAddrPtr, sockAddrSize); @@ -1025,11 +1002,8 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) { Q_Q(QNativeSocketEngine); - // ignore the SIGPIPE signal - qt_ignore_sigpipe(); - ssize_t writtenBytes; - writtenBytes = qt_safe_write(socketDescriptor, data, len); + writtenBytes = qt_safe_write_nosignal(socketDescriptor, data, len); if (writtenBytes < 0) { switch (errno) { |