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:
parent
b6c2d46008
commit
376b9d50c3
22 changed files with 293 additions and 253 deletions
12
xio-ip.c
12
xio-ip.c
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue