Skip to content

Commit 4925e22

Browse files
nolson-wlkartben
authored andcommitted
net: nsos_sockets: Fix incorrect return return on ECONNREFUSED
`nsos_connect_blocking()` is not returning the error as expected. It is expected to return a negative `NSI_ERRNO_MID_...` value, but it is returning a positive errno value. `nsos_connect_blocking()` should map the errno value to a negative `NSI_ERRNO_MID_...`, which `nsos_connect()` maps back to a -1 return with errno=`ECONNREFUSED`. the current sequence of events: - `ECONNREFUSED` occurs during connection - `nsos_connect_blocking()` returns positive `ECONNREFUSED` - `nsos_connect()` returns positive `ECONNREFUSED` - `zsock_connect()` returns positive `ECONNREFUSED` the expected sequence of events: - `ECONNREFUSED` occurs during connection - `nsos_connect_blocking()` returns negative `NSI_ERRNO_MID_ECONNREFUSED` - `nsos_connect()` returns -1, errno=`ECONNREFUSED` - `zsock_connect()` returns -1, errno=`ECONNREFUSED` Signed-off-by: Noah Olson <[email protected]>
1 parent cb24f24 commit 4925e22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/nsos_sockets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ static int nsos_connect_blocking(struct nsos_socket *sock,
677677
goto clear_nonblock;
678678
}
679679

680-
ret = so_err;
680+
ret = -nsi_errno_to_mid(so_err);
681681
}
682682

683683
clear_nonblock:

0 commit comments

Comments
 (0)