Use sockaddr_un_set_path() in socket_address_parse()

Two functional changes:
- "/" is now refused. The test is adjusted.
- The trailing NUL is *not* included in the returned size for abstract size. The
  comments in sockaddr_un_set_path() indicate that this is the right thing to do,
  and the code in socket_address_parse() wasn't doing that.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-10 00:46:44 +02:00
parent a73569f180
commit 08224f38ac
2 changed files with 8 additions and 27 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ static void test_socket_address_parse(void) {
test_socket_address_parse_one("[::1]:1234%xxxxasdf", -ENODEV, 0, NULL);
test_socket_address_parse_one("192.168.1.254:8888", 0, AF_INET, NULL);
test_socket_address_parse_one("/foo/bar", 0, AF_UNIX, NULL);
test_socket_address_parse_one("/", 0, AF_UNIX, NULL);
test_socket_address_parse_one("/", -EINVAL, 0, NULL);
test_socket_address_parse_one("@abstract", 0, AF_UNIX, NULL);
{