[git commit nptl] opensock: work correctly on IPv6-only config
Denys Vlasenko
vda.linux at googlemail.com
Fri Sep 18 14:07:31 UTC 2009
commit: http://git.uclibc.org/uClibc/commit/?id=03dad084f4c6d0c16c779a3faa84dc039c3249e6
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/nptl
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
libc/inet/opensock.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libc/inet/opensock.c b/libc/inet/opensock.c
index e80efb3..86f8c59 100644
--- a/libc/inet/opensock.c
+++ b/libc/inet/opensock.c
@@ -25,19 +25,19 @@
#include <features.h>
#include <libc-internal.h>
-/* libc_hidden_proto(socket) */
-
/* Return a socket of any type. The socket can be used in subsequent
ioctl calls to talk to the kernel. */
int __opensock(void) attribute_hidden;
int
-__opensock (void)
+__opensock(void)
{
- int fd;
+ int fd = -1;
#ifdef __UCLIBC_HAS_IPV6__
- fd = socket(AF_INET6, SOCK_DGRAM, 0);
- if (fd<0)
-#endif /* __UCLIBC_HAS_IPV6__ */
- fd = socket(AF_INET, SOCK_DGRAM, 0);
- return(fd);
+ fd = socket(AF_INET6, SOCK_DGRAM, 0);
+#endif
+#ifdef __UCLIBC_HAS_IPV4__
+ if (fd < 0)
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+#endif
+ return fd;
}
--
1.6.3.3
More information about the uClibc-cvs
mailing list