summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/inet/resolv.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 0b914c1b9..78de28337 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -315,6 +315,7 @@ Domain name in a message can be represented as either:
#include <sys/utsname.h>
#include <sys/un.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <bits/uClibc_mutex.h>
#include "internal/parse_config.h"
@@ -1824,21 +1825,18 @@ int getnameinfo(const struct sockaddr *sa,
if (hoste) {
char *c;
-#undef min
-#define min(x,y) (((x) > (y)) ? (y) : (x))
if ((flags & NI_NOFQDN)
&& (getdomainname(domain, sizeof(domain)) == 0)
&& (c = strstr(hoste->h_name, domain)) != NULL
&& (c != hoste->h_name) && (*(--c) == '.')
) {
strncpy(host, hoste->h_name,
- min(hostlen, (size_t) (c - hoste->h_name)));
- host[min(hostlen - 1, (size_t) (c - hoste->h_name))] = '\0';
+ MIN(hostlen, (size_t) (c - hoste->h_name)));
+ host[MIN(hostlen - 1, (size_t) (c - hoste->h_name))] = '\0';
} else {
strncpy(host, hoste->h_name, hostlen);
}
ok = 1;
-#undef min
}
}