Skip to content
Permalink
Browse files

Check the return code from setsockopt (in lirc.cpp)

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.
  • Loading branch information
garybuhrmaster committed May 27, 2013
1 parent 5dc844e commit 0ae45b8598110898f4779f3bdc826e1ce5abb005
Showing with 14 additions and 2 deletions.
  1. +14 −2 mythtv/libs/libmythui/lirc.cpp
@@ -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);

0 comments on commit 0ae45b8

Please sign in to comment.
You can’t perform that action at this time.