extern thread_key_t tcp_key, udp_key;
extern mutex_t tsd_lock;
- if (tcp_key == -1) {
+ if (tcp_key == KEY_INITIALIZER) {
mutex_lock(&tsd_lock);
- if (tcp_key == -1)
+ if (tcp_key == KEY_INITIALIZER)
thr_keycreate(&tcp_key, free);
mutex_unlock(&tsd_lock);
}
netid_tcp = (char *)thr_getspecific(tcp_key);
- if (udp_key == -1) {
+ if (udp_key == KEY_INITIALIZER) {
mutex_lock(&tsd_lock);
- if (udp_key == -1)
+ if (udp_key == KEY_INITIALIZER)
thr_keycreate(&udp_key, free);
mutex_unlock(&tsd_lock);
}
si.si_af == AF_INET6) {
int val = 1;
+#ifdef INET6
setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, &val, sizeof(val));
+#endif
}
return fd;
}