diff options
-rw-r--r-- | LibC/arpa/inet.cpp | 4 | ||||
-rw-r--r-- | Userland/tc.cpp | 2 | ||||
-rw-r--r-- | Userland/uc.cpp | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/LibC/arpa/inet.cpp b/LibC/arpa/inet.cpp index 790b9eb715..54fa4d62eb 100644 --- a/LibC/arpa/inet.cpp +++ b/LibC/arpa/inet.cpp @@ -29,7 +29,7 @@ int inet_pton(int af, const char* src, void* dst) int count = sscanf(src, "%u.%u.%u.%u", &a, &b, &c, &d); if (count != 4) { errno = EINVAL; - return -1; + return 0; } union { struct { @@ -45,7 +45,7 @@ int inet_pton(int af, const char* src, void* dst) u.c = c; u.d = d; *(uint32_t*)dst = u.l; - return 0; + return 1; } in_addr_t inet_addr(const char* str) diff --git a/Userland/tc.cpp b/Userland/tc.cpp index b19aa2a98e..408cbab3fb 100644 --- a/Userland/tc.cpp +++ b/Userland/tc.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) dst_addr.sin_family = AF_INET; dst_addr.sin_port = htons(80); rc = inet_pton(AF_INET, addr_str, &dst_addr.sin_addr); - if (rc < 0) { + if (rc <= 0) { perror("inet_pton"); return 1; } diff --git a/Userland/uc.cpp b/Userland/uc.cpp index c5aabda29d..4ef617616e 100644 --- a/Userland/uc.cpp +++ b/Userland/uc.cpp @@ -33,6 +33,10 @@ int main(int argc, char** argv) dst_addr.sin_family = AF_INET; dst_addr.sin_port = htons(8080); rc = inet_pton(AF_INET, addr_str, &dst_addr.sin_addr); + if (rc <= 0) { + perror("inet_pton"); + return 1; + } char buffer[BUFSIZ]; const char* msg = "Test message"; |