Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,13 @@ WS_SOCKET_T wolfSSH_get_fd(const WOLFSSH* ssh)
if (ssh)
return ssh->rfd;

/* Return the same invalid-socket sentinel wolfSSH_new() initializes
* rfd/wfd to, rather than an error enum, so callers get a value of the
* socket type they can compare against. */
#ifdef USE_WINDOWS_API
return INVALID_SOCKET;
#else
return WS_BAD_ARGUMENT;
return -1;
Comment thread
ejohnstown marked this conversation as resolved.
#endif
}

Expand Down
6 changes: 5 additions & 1 deletion tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ static void test_wolfSSH_set_fd(void)

AssertIntNE(WS_SUCCESS, wolfSSH_set_fd(NULL, fd));
check = wolfSSH_get_fd(NULL);
AssertFalse(WS_SUCCESS == check);
#ifdef USE_WINDOWS_API
AssertTrue(INVALID_SOCKET == check);
#else
AssertTrue(-1 == check);
#endif

AssertIntEQ(WS_SUCCESS, wolfSSH_set_fd(ssh, fd));
check = wolfSSH_get_fd(ssh);
Expand Down
Loading