summaryrefslogtreecommitdiff
path: root/src/sysdeps/tryipv6.c
blob: 0c7f3061b4b1ad4ee5e7558bef34a0f1fcd5a3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ISC license. */

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

#define _XPG4_2
#define _XPG6

#include <sys/types.h>

#if defined(__FreeBSD__)
# include <sys/param.h>
#endif

#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main (void)
{
  int s ;
  register int r ;
  struct in6_addr foo ;
  struct sockaddr_in6 bar ;
  memset(&foo, 0, sizeof(struct sockaddr_in6)) ;
  bar.sin6_addr = foo ;
  bar.sin6_port = 1026 ;
  s = socket(AF_INET6, SOCK_STREAM, 0) ;
  if (s < 0) return 111 ;
  do r = connect(s, (struct sockaddr *)&bar, sizeof bar) ;
  while ((r == -1) && (errno == EINTR)) ;
  if ((r == -1) && (errno == EALREADY)) errno = EINPROGRESS ;
  return 0 ;
}