aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/getsourcefilter.c28
-rw-r--r--sysdeps/unix/sysv/linux/setsourcefilter.c9
2 files changed, 21 insertions, 16 deletions
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.c b/sysdeps/unix/sysv/linux/getsourcefilter.c
index fdcf8d6..a6f89a3 100644
--- a/sysdeps/unix/sysv/linux/getsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.c
@@ -1,5 +1,5 @@
/* Get source filter. Linux version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -112,23 +112,27 @@ getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
gf->gf_numsrc = *numsrc;
/* We need to provide the appropriate socket level value. */
+ int result;
int sol = __get_sol (group->sa_family, grouplen);
if (sol == -1)
{
__set_errno (EINVAL);
- return -1;
+ result = -1;
}
-
- int result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
-
- /* If successful, copy the results to the places the caller wants
- them in. */
- if (result == 0)
+ else
{
- *fmode = gf->gf_fmode;
- memcpy (slist, gf->gf_slist,
- MIN (*numsrc, gf->gf_numsrc) * sizeof (struct sockaddr_storage));
- *numsrc = gf->gf_numsrc;
+ result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
+
+ /* If successful, copy the results to the places the caller wants
+ them in. */
+ if (result == 0)
+ {
+ *fmode = gf->gf_fmode;
+ memcpy (slist, gf->gf_slist,
+ MIN (*numsrc, gf->gf_numsrc)
+ * sizeof (struct sockaddr_storage));
+ *numsrc = gf->gf_numsrc;
+ }
}
if (! use_alloca)
diff --git a/sysdeps/unix/sysv/linux/setsourcefilter.c b/sysdeps/unix/sysv/linux/setsourcefilter.c
index f5c4d97..dc223de 100644
--- a/sysdeps/unix/sysv/linux/setsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setsourcefilter.c
@@ -1,5 +1,5 @@
/* Set source filter. Linux version.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -57,14 +57,15 @@ setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
/* We need to provide the appropriate socket level value. */
+ int result;
int sol = __get_sol (group->sa_family, grouplen);
if (sol == -1)
{
__set_errno (EINVAL);
- return -1;
+ result = -1;
}
-
- int result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
+ else
+ result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
if (! use_alloca)
{