The system call write() should never be given a null
From: Erik Hovland <erik@hovland.org>
pointer to store data in, even if there is a write length
of zero.
---
mythtv/libs/libmythdb/msocketdevice_unix.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/mythtv/libs/libmythdb/msocketdevice_unix.cpp b/mythtv/libs/libmythdb/msocketdevice_unix.cpp
index ee895ae..1c1f7eb 100644
a
|
b
|
qint64 MSocketDevice::readData( char *data, qint64 maxlen ) |
825 | 825 | */ |
826 | 826 | qint64 MSocketDevice::writeData( const char *data, qint64 len ) |
827 | 827 | { |
828 | | if ( data == 0 && len != 0 ) { |
| 828 | if ( len == 0 ) |
| 829 | return 0; |
| 830 | |
| 831 | if ( data == 0 ) { |
829 | 832 | #if defined(QT_CHECK_NULL) || defined(QSOCKETDEVICE_DEBUG) |
830 | 833 | qWarning( "MSocketDevice::writeBlock: Null pointer error" ); |
831 | 834 | #endif |
… |
… |
qint64 MSocketDevice::writeData( const char *data, qint64 len ) |
913 | 916 | qint64 MSocketDevice::writeBlock( const char * data, quint64 len, |
914 | 917 | const QHostAddress & host, quint16 port ) |
915 | 918 | { |
| 919 | if ( len == 0 ) |
| 920 | return 0; |
| 921 | |
916 | 922 | if ( t != Datagram ) { |
917 | 923 | #if defined(QT_CHECK_STATE) || defined(QSOCKETDEVICE_DEBUG) |
918 | 924 | qWarning( "MSocketDevice::sendBlock: Not datagram" ); |
… |
… |
qint64 MSocketDevice::writeBlock( const char * data, quint64 len, |
920 | 926 | return -1; // for now - later we can do t/tcp |
921 | 927 | } |
922 | 928 | |
923 | | if ( data == 0 && len != 0 ) { |
| 929 | if ( data == 0 ) { |
924 | 930 | #if defined(QT_CHECK_NULL) || defined(QSOCKETDEVICE_DEBUG) |
925 | 931 | qWarning( "MSocketDevice::sendBlock: Null pointer error" ); |
926 | 932 | #endif |