diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/getservbyname_r.c | 4 | ||||
-rw-r--r-- | src/network/getservbyport_r.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/network/getservbyname_r.c b/src/network/getservbyname_r.c index 5c025150..efa5d910 100644 --- a/src/network/getservbyname_r.c +++ b/src/network/getservbyname_r.c @@ -12,6 +12,10 @@ int getservbyname_r(const char *name, const char *prots, struct addrinfo *ai, hint = { .ai_family = AF_INET }; int i; + if (!prots) return -( + getservbyname_r(name, "tcp", se, buf, buflen, res) + && getservbyname_r(name, "udp", se, buf, buflen, res) ); + /* Align buffer */ i = (uintptr_t)buf & sizeof(char *)-1; if (!i) i = sizeof(char *); diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c index f119abc8..821afae9 100644 --- a/src/network/getservbyport_r.c +++ b/src/network/getservbyport_r.c @@ -15,6 +15,10 @@ int getservbyport_r(int port, const char *prots, .sin_port = port, }; + if (!prots) return -( + getservbyport_r(port, "tcp", se, buf, buflen, res) + && getservbyport_r(port, "udp", se, buf, buflen, res) ); + /* Align buffer */ i = (uintptr_t)buf & sizeof(char *)-1; if (!i) i = sizeof(char *); |