aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-24 18:27:33 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-25 14:37:25 +0200
commit491a42d046376ef4d9ddf5d7642ed2f557dda6e6 (patch)
tree7937199e49f8db99c83978d16c6a8e6cc483f33a
parent642a1b1aa4027501a770725a368dc841e8e12161 (diff)
downloadlibssh-491a42d046376ef4d9ddf5d7642ed2f557dda6e6.tar.gz
libssh-491a42d046376ef4d9ddf5d7642ed2f557dda6e6.tar.xz
libssh-491a42d046376ef4d9ddf5d7642ed2f557dda6e6.zip
socket: Reformat ssh_socket_unbuffered_read()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/socket.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/socket.c b/src/socket.c
index 8d1217bc..64c4ab1a 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -524,28 +524,30 @@ int ssh_socket_is_open(ssh_socket s) {
/** \internal
* \brief read len bytes from socket into buffer
*/
-static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len) {
- int rc = -1;
+static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len)
+{
+ int rc = -1;
- if (s->data_except) {
- return -1;
- }
- if(s->fd_is_socket)
- rc = recv(s->fd_in,buffer, len, 0);
- else
- rc = read(s->fd_in,buffer, len);
+ if (s->data_except) {
+ return -1;
+ }
+ if (s->fd_is_socket) {
+ rc = recv(s->fd_in,buffer, len, 0);
+ } else {
+ rc = read(s->fd_in,buffer, len);
+ }
#ifdef _WIN32
- s->last_errno = WSAGetLastError();
+ s->last_errno = WSAGetLastError();
#else
- s->last_errno = errno;
+ s->last_errno = errno;
#endif
- s->read_wontblock = 0;
+ s->read_wontblock = 0;
- if (rc < 0) {
- s->data_except = 1;
- }
+ if (rc < 0) {
+ s->data_except = 1;
+ }
- return rc;
+ return rc;
}
/** \internal