[PATCH 3/6] chunkd: Don't return positive value on stc_get_recv failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



stc_get_recv may return positive errno value on failure.

Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
---
 lib/chunkdc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/chunkdc.c b/lib/chunkdc.c
index 2ed976b..91c42dc 100644
--- a/lib/chunkdc.c
+++ b/lib/chunkdc.c
@@ -431,7 +431,7 @@ size_t stc_get_recv(struct st_client *stc, void *data, size_t data_len)
 			if (done_cnt == data_len)
 				break;
 			if (ioctl(stc->fd, FIONREAD, &avail))
-				return errno;
+				return -errno;
 			if (avail == 0) {
 				if ((avail = SSL_pending(stc->ssl)) == 0)
 					break;
@@ -457,14 +457,14 @@ size_t stc_get_recv(struct st_client *stc, void *data, size_t data_len)
 		}
 	} else {
 		if (ioctl(stc->fd, FIONREAD, &avail))
-			return errno;
+			return -errno;
 		if (avail) {
 			if ((xfer_len = avail) > data_len)
 				xfer_len = data_len;
 
 			rc = read(stc->fd, data, xfer_len);
 			if (rc < 0)
-				return errno;
+				return -errno;
 
 			done_cnt += rc;
 		}
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Fedora Clound]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux