From ffa3a56ab8f67a2c137f68fe5611fa6524128a8c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 23 Nov 2013 12:04:02 +0100 Subject: buffer: reduce indentation in read_buffer() Signed-off-by: Michael Adam --- src/buffer.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 49216fd..4c046c6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -236,29 +236,27 @@ ssize_t read_buffer (int fd, struct buffer_s * buffptr) "readbuff: add_to_buffer() error."); bytesin = -1; } + } else if (bytesin == 0) { + /* connection was closed by client */ + bytesin = -1; } else { - if (bytesin == 0) { - /* connection was closed by client */ - bytesin = -1; - } else { - switch (errno) { + switch (errno) { #ifdef EWOULDBLOCK - case EWOULDBLOCK: + case EWOULDBLOCK: #else # ifdef EAGAIN - case EAGAIN: + case EAGAIN: # endif #endif - case EINTR: - bytesin = 0; - break; - default: - log_message (LOG_ERR, - "readbuff: recv() error \"%s\" on file descriptor %d", - strerror (errno), fd); - bytesin = -1; - break; - } + case EINTR: + bytesin = 0; + break; + default: + log_message (LOG_ERR, + "readbuff: recv() error \"%s\" on file descriptor %d", + strerror (errno), fd); + bytesin = -1; + break; } } -- cgit v1.2.3