diff --git a/Userland/Libraries/LibC/arpa/inet.cpp b/Userland/Libraries/LibC/arpa/inet.cpp index 03c7b726f3..a3be63ac94 100644 --- a/Userland/Libraries/LibC/arpa/inet.cpp +++ b/Userland/Libraries/LibC/arpa/inet.cpp @@ -62,7 +62,7 @@ in_addr_t inet_addr(const char* str) { in_addr_t tmp {}; int rc = inet_pton(AF_INET, str, &tmp); - if (rc < 0) + if (rc <= 0) return INADDR_NONE; return tmp; } diff --git a/Userland/Utilities/nc.cpp b/Userland/Utilities/nc.cpp index b56b422953..10c9354cf9 100644 --- a/Userland/Utilities/nc.cpp +++ b/Userland/Utilities/nc.cpp @@ -87,7 +87,7 @@ int main(int argc, char** argv) sa.sin_port = htons(port); sa.sin_addr.s_addr = htonl(INADDR_ANY); if (target) { - if (inet_pton(AF_INET, target, &sa.sin_addr) < 0) { + if (inet_pton(AF_INET, target, &sa.sin_addr) <= 0) { perror("inet_pton"); return 1; }