aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2018-08-04 17:52:16 +0800
committerJun Zhao <jun.zhao@intel.com>2018-08-18 16:16:11 +0800
commit0ed0af595b691121d08bad23b56adf24a23a7ae5 (patch)
tree006199827206024bc533fb557995775e12c7a9a5 /libavformat/tcp.c
parent0a8ff1d8bb07e8ffbbe5dbdc3885bcd6113188e6 (diff)
downloadffmpeg-0ed0af595b691121d08bad23b56adf24a23a7ae5.tar.gz
lavf/tcp: check return value of setsockopt.
when setsockopt fail, use ff_log_net_error to dump the string describing for error number. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 499e365b78..8bff9a3867 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -151,17 +151,25 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
/* Set the socket's send or receive buffer sizes, if specified.
If unspecified or setting fails, system default is used. */
if (s->recv_buffer_size > 0) {
- setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &s->recv_buffer_size, sizeof (s->recv_buffer_size));
+ if (setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &s->recv_buffer_size, sizeof (s->recv_buffer_size))) {
+ ff_log_net_error(h, AV_LOG_WARNING, "setsockopt(SO_RCVBUF)");
+ }
}
if (s->send_buffer_size > 0) {
- setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &s->send_buffer_size, sizeof (s->send_buffer_size));
+ if (setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &s->send_buffer_size, sizeof (s->send_buffer_size))) {
+ ff_log_net_error(h, AV_LOG_WARNING, "setsockopt(SO_SNDBUF)");
+ }
}
if (s->tcp_nodelay > 0) {
- setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &s->tcp_nodelay, sizeof (s->tcp_nodelay));
+ if (setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &s->tcp_nodelay, sizeof (s->tcp_nodelay))) {
+ ff_log_net_error(h, AV_LOG_WARNING, "setsockopt(TCP_NODELAY)");
+ }
}
#if !HAVE_WINSOCK2_H
if (s->tcp_mss > 0) {
- setsockopt (fd, IPPROTO_TCP, TCP_MAXSEG, &s->tcp_mss, sizeof (s->tcp_mss));
+ if (setsockopt (fd, IPPROTO_TCP, TCP_MAXSEG, &s->tcp_mss, sizeof (s->tcp_mss))) {
+ ff_log_net_error(h, AV_LOG_WARNING, "setsockopt(TCP_MAXSEG)");
+ }
}
#endif /* !HAVE_WINSOCK2_H */