Skip to content

Commit 983979f

Browse files
committed
inet_pton: don't assume addr families don't exist
Address family 5 might exist on some crazy system like Haiku. Use `INT_MAX-1` as an unsupported address family.
1 parent 33ea4aa commit 983979f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/core/posix.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ void test_core_posix__inet_pton(void)
9494
cl_assert(p_inet_pton(AF_INET, "10.foo.bar.1", &addr) == 0);
9595

9696
/* Test unsupported address families */
97-
cl_git_fail(p_inet_pton(12, "52.472", &addr)); /* AF_DECnet */
98-
cl_assert_equal_i(EAFNOSUPPORT, errno);
99-
100-
cl_git_fail(p_inet_pton(5, "315.124", &addr)); /* AF_CHAOS */
97+
cl_git_fail(p_inet_pton(INT_MAX-1, "52.472", &addr));
10198
cl_assert_equal_i(EAFNOSUPPORT, errno);
10299
}
103100

0 commit comments

Comments
 (0)