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
(cherry picked from commit db44509)

Fixes #11586

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
garybuhrmaster authored and stuartm committed Jun 15, 2013
1 parent b89b021 commit fa1a178
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 fa1a178

Please sign in to comment.