multifdsink: do check return values of fcntl() and fstat()

https://bugzilla.gnome.org/show_bug.cgi?id=647294
This commit is contained in:
Tim-Philipp Müller 2011-04-12 12:20:43 +01:00
parent bf2b14f860
commit a90adccacd

View file

@ -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);
}