[FFmpeg-devel,2/4] lavf/network: check return value of setsockopt.

Submitted by Jun Zhao on Aug. 5, 2018, 1:14 p.m.

Details

Message ID 1533474873-10436-3-git-send-email-mypopydev@gmail.com
State Accepted
Commit 0a8ff1d8bb07e8ffbbe5dbdc3885bcd6113188e6
Headers show

Commit Message

Jun Zhao Aug. 5, 2018, 1:14 p.m.
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 libavformat/network.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/network.c b/libavformat/network.c
index 21c836a..4bae7e2 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -194,8 +194,11 @@  int ff_socket(int af, int type, int proto)
 #endif
     }
 #ifdef SO_NOSIGPIPE
-    if (fd != -1)
-        setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int));
+    if (fd != -1) {
+        if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int))) {
+             av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_NOSIGPIPE) failed\n");
+        }
+    }
 #endif
     return fd;
 }