Skip to content

Commit

Permalink
MBroadcastSocketDevice: Fix Coverity ID 746753 Unchecked return value
Browse files Browse the repository at this point in the history
In MBroadcastSocketDevice::~MBroadcastSocketDevice(): Value returned from a
library function is not checked for errors before being used. This value may
indicate an error condition.
  • Loading branch information
Paul Harrison committed Jun 15, 2013
1 parent 253a73c commit 2b074dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mythtv/libs/libmythupnp/mbroadcastsocketdevice.h
Expand Up @@ -38,7 +38,7 @@ class MBroadcastSocketDevice : public MSocketDevice

int one = 1;
if (setsockopt(socket(), SOL_SOCKET, SO_BROADCAST,
(const char *)&one, sizeof(one)) < 0)
(const char *)&one, sizeof(one)) < 0)
{
LOG(VB_GENERAL, LOG_ERR, "setsockopt - SO_BROADCAST Error" + ENO);
}
Expand All @@ -51,8 +51,11 @@ class MBroadcastSocketDevice : public MSocketDevice
virtual ~MBroadcastSocketDevice()
{
int zero = 0;
setsockopt(socket(), SOL_SOCKET, SO_BROADCAST, (const char *)&zero,
sizeof(zero));
if (setsockopt(socket(), SOL_SOCKET, SO_BROADCAST, (const char *)&zero,
sizeof(zero)) < 0)
{
LOG(VB_GENERAL, LOG_ERR, "setsockopt - SO_BROADCAST Error" + ENO);
}
}

virtual QHostAddress address() const { return m_address; }
Expand Down

0 comments on commit 2b074dd

Please sign in to comment.