From a90adccacd736ad875cf6e462635ced50a51dd58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 12 Apr 2011 12:20:43 +0100 Subject: [PATCH] multifdsink: do check return values of fcntl() and fstat() https://bugzilla.gnome.org/show_bug.cgi?id=647294 --- gst/tcp/gstmultifdsink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index 4e091e3be4..98c62d771a 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -876,7 +876,11 @@ gst_multi_fd_sink_add_full (GstMultiFdSink * sink, int fd, sink->clients_cookie++; /* set the socket to non blocking */ - fcntl (fd, F_SETFL, O_NONBLOCK); + if (fcntl (fd, F_SETFL, O_NONBLOCK) < 0) { + GST_ERROR_OBJECT (sink, "failed to make socket %d non-blocking: %s", fd, + g_strerror (errno)); + } + /* we always read from a client */ gst_poll_add_fd (sink->fdset, &client->fd); @@ -888,8 +892,7 @@ gst_multi_fd_sink_add_full (GstMultiFdSink * sink, int fd, } } /* figure out the mode, can't use send() for non sockets */ - fstat (fd, &statbuf); - if (S_ISSOCK (statbuf.st_mode)) { + if (fstat (fd, &statbuf) == 0 && S_ISSOCK (statbuf.st_mode)) { client->is_socket = TRUE; setup_dscp_client (sink, client); }