Do not pass uninitialised values to setsockopt(). (fixes #167704)

Original commit message from CVS:
Do not pass uninitialised values to setsockopt(). (fixes #167704)
This commit is contained in:
Tim-Philipp Müller 2005-02-17 17:56:39 +00:00
parent 232ea470f6
commit eb33462a15
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2005-02-17 Luca Ognibene <luogni at tin dot it>
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
* gst/tcp/gsttcpserversink.c: (gst_tcpserversink_init_send):
Don't pass uninitialised values to setsockopt(). (fixes #167704)
2005-02-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/playback/gstplaybin.c: (add_sink):

View file

@ -286,16 +286,18 @@ gst_tcpserversink_init_send (GstMultiFdSink * parent)
this->server_sock.fd);
/* make address reusable */
if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_REUSEADDR, &ret,
sizeof (int)) < 0) {
ret = 1;
if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_REUSEADDR,
(void *) &ret, sizeof (ret)) < 0) {
gst_tcp_socket_close (&this->server_sock.fd);
GST_ELEMENT_ERROR (this, RESOURCE, SETTINGS, (NULL),
("Could not setsockopt: %s", g_strerror (errno)));
return FALSE;
}
/* keep connection alive; avoids SIGPIPE during write */
if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_KEEPALIVE, &ret,
sizeof (int)) < 0) {
ret = 1;
if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_KEEPALIVE,
(void *) &ret, sizeof (ret)) < 0) {
gst_tcp_socket_close (&this->server_sock.fd);
GST_ELEMENT_ERROR (this, RESOURCE, SETTINGS, (NULL),
("Could not setsockopt: %s", g_strerror (errno)));