aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2017-07-13 02:26:10 +0200
committerMichael Adam <obnox@samba.org>2017-07-27 14:15:40 +0200
commit4c6082d88e1241fe678687fb0d19480e17e700e5 (patch)
treebc8bd14ea99cd7069dbafcac4b572d9c97684669 /src
parentd6253b326ee53c4278458fc425335b64519d93dd (diff)
downloadsocket_wrapper-4c6082d88e1241fe678687fb0d19480e17e700e5.tar.gz
socket_wrapper-4c6082d88e1241fe678687fb0d19480e17e700e5.tar.xz
socket_wrapper-4c6082d88e1241fe678687fb0d19480e17e700e5.zip
swrap: Add common exit point to swrap_auto_bind
In preparation for thread safety. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 3e429e7..518f838 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3174,7 +3174,8 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
break;
default:
errno = ESOCKTNOSUPPORT;
- return -1;
+ ret = -1;
+ goto done;
}
memset(&in, 0, sizeof(in));
@@ -3194,7 +3195,8 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
if (si->family != family) {
errno = ENETUNREACH;
- return -1;
+ ret = -1;
+ goto done;
}
switch (si->type) {
@@ -3206,7 +3208,8 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
break;
default:
errno = ESOCKTNOSUPPORT;
- return -1;
+ ret = -1;
+ goto done;
}
memset(&in6, 0, sizeof(in6));
@@ -3223,7 +3226,8 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
#endif
default:
errno = ESOCKTNOSUPPORT;
- return -1;
+ ret = -1;
+ goto done;
}
if (autobind_start > 60000) {
@@ -3239,7 +3243,7 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
ret = libc_bind(fd, &un_addr.sa.s, un_addr.sa_socklen);
if (ret == -1) {
- return ret;
+ goto done;
}
si->un_addr = un_addr.sa.un;
@@ -3256,13 +3260,17 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
socket_wrapper_default_iface(),
0);
errno = ENFILE;
- return -1;
+ ret = -1;
+ goto done;
}
si->family = family;
set_port(si->family, port, &si->myname);
- return 0;
+ ret = 0;
+
+done:
+ return ret;
}
/****************************************************************************