mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
nettimeprovider: handle invalid network addresses earlier
Handle inet_aton() return code.
This commit is contained in:
parent
7fc30f2d83
commit
5cc2e6af79
1 changed files with 13 additions and 2 deletions
|
@ -373,8 +373,11 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
|
|||
my_addr.sin_family = AF_INET; /* host byte order */
|
||||
my_addr.sin_port = htons ((gint16) self->port); /* short, network byte order */
|
||||
my_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
if (self->address)
|
||||
inet_aton (self->address, &my_addr.sin_addr);
|
||||
if (self->address) {
|
||||
ret = inet_aton (self->address, &my_addr.sin_addr);
|
||||
if (ret == 0)
|
||||
goto invalid_address_error;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (self, "binding on port %d", self->port);
|
||||
ret =
|
||||
|
@ -428,6 +431,14 @@ setsockopt_error:
|
|||
g_strerror (errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
invalid_address_error:
|
||||
{
|
||||
close (self->priv->sock.fd);
|
||||
self->priv->sock.fd = -1;
|
||||
GST_ERROR_OBJECT (self, "invalid network address %s: %s (%d)",
|
||||
self->address, g_strerror (errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
bind_error:
|
||||
{
|
||||
close (self->priv->sock.fd);
|
||||
|
|
Loading…
Reference in a new issue