mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
socket: Reformat ssh_socket_unbuffered_read()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -524,16 +524,18 @@ int ssh_socket_is_open(ssh_socket s) {
|
|||||||
/** \internal
|
/** \internal
|
||||||
* \brief read len bytes from socket into buffer
|
* \brief read len bytes from socket into buffer
|
||||||
*/
|
*/
|
||||||
static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len) {
|
static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len)
|
||||||
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
if (s->data_except) {
|
if (s->data_except) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(s->fd_is_socket)
|
if (s->fd_is_socket) {
|
||||||
rc = recv(s->fd_in,buffer, len, 0);
|
rc = recv(s->fd_in,buffer, len, 0);
|
||||||
else
|
} else {
|
||||||
rc = read(s->fd_in,buffer, len);
|
rc = read(s->fd_in,buffer, len);
|
||||||
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
s->last_errno = WSAGetLastError();
|
s->last_errno = WSAGetLastError();
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user