mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibC: inet_pton() should return 1 on success, 0 or -1 on failure.
This commit is contained in:
parent
d080f6e8dd
commit
d03505bc29
3 changed files with 7 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue