mbedtls_net_context: make fd public on Unix/POSIX platforms
On platforms with BSD-like sockets, it is useful for applications to have access to the underlying file descriptor so that they can use functions like select() and poll(). Do not promise that the field will exist on other platforms such as Windows (where the type and name of the field are technically wrong because Windows socket handles are actually not file descriptors). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
ce9e3a92fe
commit
b11d61e095
2 changed files with 9 additions and 3 deletions
|
@ -246,13 +246,13 @@ int main( void )
|
|||
addr.sin_addr.s_addr = *((char *) &ret) == ret ? ADDR_LE : ADDR_BE;
|
||||
ret = 0;
|
||||
|
||||
if( ( server_fd.MBEDTLS_PRIVATE(fd) = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 )
|
||||
if( ( server_fd.fd = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 )
|
||||
{
|
||||
ret = socket_failed;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( connect( server_fd.MBEDTLS_PRIVATE(fd),
|
||||
if( connect( server_fd.fd,
|
||||
(const struct sockaddr *) &addr, sizeof( addr ) ) < 0 )
|
||||
{
|
||||
ret = connect_failed;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue