1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-27 04:57:51 +00:00

reworked so-type, so-prototype

This commit is contained in:
Gerhard Rieger 2008-09-20 23:47:06 +02:00
parent b6c2d46008
commit 376b9d50c3
22 changed files with 293 additions and 253 deletions

View file

@ -205,6 +205,18 @@ int xiogetaddrinfo(const char *node, const char *service,
if (node != NULL || service != NULL) {
struct addrinfo *record;
if (socktype != SOCK_STREAM && socktype != SOCK_DGRAM) {
/* actual socket type value is not supported - fallback to a good one */
socktype = SOCK_DGRAM;
}
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
/* actual protocol value is not supported - fallback to a good one */
if (socktype == SOCK_DGRAM) {
protocol = IPPROTO_UDP;
} else {
protocol = IPPROTO_TCP;
}
}
hints.ai_flags |= AI_PASSIVE;
hints.ai_family = family;
hints.ai_socktype = socktype;