[FFmpeg-cvslog] avformat/tcp: re-add checks for setsockopt return values
James Almer
git at videolan.org
Tue Sep 11 21:54:19 EEST 2018
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Sep 11 15:27:09 2018 -0300| [092cbbfa74d837703effad2ce752d46f12c1e24e] | committer: James Almer
avformat/tcp: re-add checks for setsockopt return values
Originally added in 0ed0af595b691121d08bad23b56adf24a23a7ae5 and lost
by mistake in ef71ef5f30ddf1cd61e46628a04608892caf76d2.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=092cbbfa74d837703effad2ce752d46f12c1e24e
---
libavformat/tcp.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index ea41f2e986..2198e0f00e 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -76,17 +76,25 @@ static void customize_fd(void *ctx, int fd)
/* 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(ctx, 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(ctx, 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(ctx, 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(ctx, AV_LOG_WARNING, "setsockopt(TCP_MAXSEG)");
+ }
}
#endif /* !HAVE_WINSOCK2_H */
}
More information about the ffmpeg-cvslog
mailing list