From db44509884e10110b81332f53d7c9e56af7b2f61 Mon Sep 17 00:00:00 2001 From: Gary Buhrmaster Date: Mon, 10 Jun 2013 17:37:46 +0000 Subject: [PATCH] Patch to check success of the socket creation While unlikely, the socket creation could fail, returning an error rather than a file descriptor. Log it, and continue. Fixes coverity 746816 --- mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp index 254b06b9296..432d2480d9c 100644 --- a/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp @@ -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;