summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-01-07 15:27:51 -0800
committerJeremy Allison <jra@samba.org>2011-01-08 01:48:27 +0100
commit52aac4dd54e5b965505049828b3505c7109a6c8e (patch)
treee90cc225b951126a7a6cdb8f77d6d78fbd845265 /nsswitch
parent3e61c97a7e20a55be53f60c761091933ced53570 (diff)
downloadsamba-52aac4dd54e5b965505049828b3505c7109a6c8e.tar.gz
samba-52aac4dd54e5b965505049828b3505c7109a6c8e.tar.bz2
samba-52aac4dd54e5b965505049828b3505c7109a6c8e.zip
Move wins_lookup_open_socket_in() to remove a compile warning.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Jan 8 01:48:27 CET 2011 on sn-devel-104
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/wins.c87
1 files changed, 43 insertions, 44 deletions
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 51b78fba9a..eba27bc287 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -45,50 +45,6 @@ NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he,
char *buffer, size_t buflen, int *h_errnop);
-/* Use our own create socket code so we don't recurse.... */
-
-static int wins_lookup_open_socket_in(void)
-{
- struct sockaddr_in sock;
- int val=1;
- int res;
-
- memset((char *)&sock,'\0',sizeof(sock));
-
-#ifdef HAVE_SOCK_SIN_LEN
- sock.sin_len = sizeof(sock);
-#endif
- sock.sin_port = 0;
- sock.sin_family = AF_INET;
- sock.sin_addr.s_addr = interpret_addr("0.0.0.0");
- res = socket(AF_INET, SOCK_DGRAM, 0);
- if (res == -1)
- return -1;
-
- if (setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val)) != 0) {
- close(res);
- return -1;
- }
-#ifdef SO_REUSEPORT
- if (setsockopt(res,SOL_SOCKET,SO_REUSEPORT,(char *)&val,sizeof(val)) != 0) {
- close(res);
- return -1;
- }
-#endif /* SO_REUSEPORT */
-
- /* now we've got a socket - we need to bind it */
-
- if (bind(res, (struct sockaddr * ) &sock,sizeof(sock)) < 0) {
- close(res);
- return(-1);
- }
-
- set_socket_options(res,"SO_BROADCAST");
-
- return res;
-}
-
-
static void nss_wins_init(void)
{
initialised = 1;
@@ -158,6 +114,49 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
#ifdef HAVE_NS_API_H
+/* Use our own create socket code so we don't recurse.... */
+
+static int wins_lookup_open_socket_in(void)
+{
+ struct sockaddr_in sock;
+ int val=1;
+ int res;
+
+ memset((char *)&sock,'\0',sizeof(sock));
+
+#ifdef HAVE_SOCK_SIN_LEN
+ sock.sin_len = sizeof(sock);
+#endif
+ sock.sin_port = 0;
+ sock.sin_family = AF_INET;
+ sock.sin_addr.s_addr = interpret_addr("0.0.0.0");
+ res = socket(AF_INET, SOCK_DGRAM, 0);
+ if (res == -1)
+ return -1;
+
+ if (setsockopt(res,SOL_SOCKET,SO_REUSEADDR,(char *)&val,sizeof(val)) != 0) {
+ close(res);
+ return -1;
+ }
+#ifdef SO_REUSEPORT
+ if (setsockopt(res,SOL_SOCKET,SO_REUSEPORT,(char *)&val,sizeof(val)) != 0) {
+ close(res);
+ return -1;
+ }
+#endif /* SO_REUSEPORT */
+
+ /* now we've got a socket - we need to bind it */
+
+ if (bind(res, (struct sockaddr * ) &sock,sizeof(sock)) < 0) {
+ close(res);
+ return(-1);
+ }
+
+ set_socket_options(res,"SO_BROADCAST");
+
+ return res;
+}
+
static struct node_status *lookup_byaddr_backend(char *addr, int *count)
{
int fd;