@@ -1439,7 +1439,9 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX;
q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
q_unix->path = g_strdup(path);
+ q_unix->has_tight = true;
q_unix->tight = tight;
+ q_unix->has_abstract = true;
q_unix->abstract = abstract;
} else if (host) {
addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET;
@@ -294,13 +294,13 @@ static void test_socket_unix_abstract(void)
abstract_socket_matrix_row matrix[ABSTRACT_SOCKET_VARIANTS] = {
{ &addr,
{ &addr_tight, &addr_padded, &addr },
- { false /* BUG */, true /* BUG */, true } },
+ { true, false, true } },
{ &addr_tight,
{ &addr_padded, &addr, &addr_tight },
- { false, false /* BUG */, true } },
+ { false, true, true } },
{ &addr_padded,
{ &addr, &addr_tight, &addr_padded },
- { true /* BUG */, false, true } }
+ { false, false, true } }
};
int i;
@@ -925,7 +925,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
if (saddr->abstract) {
un.sun_path[0] = '\0';
memcpy(&un.sun_path[1], path, pathlen);
- if (saddr->tight) {
+ if (!saddr->has_tight || saddr->tight) {
addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + pathlen;
}
} else {
@@ -985,7 +985,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp)
if (saddr->abstract) {
un.sun_path[0] = '\0';
memcpy(&un.sun_path[1], saddr->path, pathlen);
- if (saddr->tight) {
+ if (!saddr->has_tight || saddr->tight) {
addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + pathlen;
}
} else {