net_socket: binding on the same socket should return an error
Change-Id: I7b948435f6e4009d9c11d2163172ad0ab6484e1d Reviewed-on: https://review.haiku-os.org/c/haiku/+/6458 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
e5f221f598
commit
740f3ca4ae
@ -1006,12 +1006,8 @@ socket_bind(net_socket* socket, const struct sockaddr* address,
|
||||
addressLength = sizeof(sockaddr);
|
||||
}
|
||||
|
||||
if (socket->address.ss_len != 0) {
|
||||
status_t status = socket->first_info->unbind(socket->first_protocol,
|
||||
(sockaddr*)&socket->address);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
}
|
||||
if (socket->address.ss_len != 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
memcpy(&socket->address, address, sizeof(sockaddr));
|
||||
socket->address.ss_len = sizeof(sockaddr_storage);
|
||||
|
Loading…
x
Reference in New Issue
Block a user