Skip to content

Commit

Permalink
Patch to check success of the socket creation
Browse files Browse the repository at this point in the history
While unlikely, the socket creation could fail,
returning an error rather than a file descriptor.
Log it, and continue.

Fixes coverity 746816
  • Loading branch information
garybuhrmaster committed Jun 10, 2013
1 parent fde1c16 commit db44509
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp
Expand Up @@ -180,6 +180,12 @@ void IPTVStreamHandler::run(void)
// we need to open the descriptor ourselves so we
// can set some socket options
int fd = socket(AF_INET, SOCK_DGRAM, 0); // create IPv4 socket
if (fd < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Unable to create socket " + ENO);
continue;
}
int buf_size = 2 * 1024 * max(tuning.GetBitrate(i)/1000, 500U);
if (!tuning.GetBitrate(i))
buf_size = 2 * 1024 * 1024;
Expand Down

0 comments on commit db44509

Please sign in to comment.