Skip to content

Commit

Permalink
Check the return code from setsockopt (in lirc.cpp)
Browse files Browse the repository at this point in the history
Static analysis (coverity) identified that the return code
from setsockopt was not checked.  This patch checks the
return code, with a log message if the setting fails.
(cherry picked from commit 0ae45b8)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11550
  • Loading branch information
garybuhrmaster authored and stuartm committed Jun 4, 2013
1 parent c6ffdf4 commit b578a5e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions mythtv/libs/libmythui/lirc.cpp
Expand Up @@ -274,9 +274,21 @@ bool LIRC::Init(void)

// Attempt to inline out-of-band messages and keep the connection open..
int i = 1;
setsockopt(lircd_socket, SOL_SOCKET, SO_OOBINLINE, &i, sizeof(i));
ret = setsockopt(lircd_socket, SOL_SOCKET, SO_OOBINLINE, &i, sizeof(i));
if (ret < 0)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
QString("Failed setting OOBINLINE option for socket '%1'")
.arg(lircdDevice) + ENO);
}
i = 1;
setsockopt(lircd_socket, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i));
ret = setsockopt(lircd_socket, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i));
if (ret < 0)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
QString("Failed setting KEEPALIVE option for socket '%1'")
.arg(lircdDevice) + ENO);
}
}

d->lircState = lirc_init("/etc/lircrc", ".lircrc", "mythtv", NULL, 0);
Expand Down

0 comments on commit b578a5e

Please sign in to comment.