summaryrefslogtreecommitdiff
path: root/src/rio.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-07-17 16:46:04 +0200
committerantirez <antirez@gmail.com>2019-07-17 16:46:22 +0200
commit6b72b04a37e7a17bb1adc822d0685f6fd39886ff (patch)
tree858f2feb75a925b6c9922d29d127eca389c42f06 /src/rio.h
parent5189db3d818a7058283bad4f53fe88a59ef76ff1 (diff)
downloadredis-6b72b04a37e7a17bb1adc822d0685f6fd39886ff.tar.gz
Rio: when in error condition avoid doing the operation.
Diffstat (limited to 'src/rio.h')
-rw-r--r--src/rio.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rio.h b/src/rio.h
index 66036b5bd..6199bb039 100644
--- a/src/rio.h
+++ b/src/rio.h
@@ -102,6 +102,7 @@ typedef struct _rio rio;
* if needed. */
static inline size_t rioWrite(rio *r, const void *buf, size_t len) {
+ if (r->flags & RIO_FLAG_WRITE_ERROR) return 0;
while (len) {
size_t bytes_to_write = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len;
if (r->update_cksum) r->update_cksum(r,buf,bytes_to_write);
@@ -117,6 +118,7 @@ static inline size_t rioWrite(rio *r, const void *buf, size_t len) {
}
static inline size_t rioRead(rio *r, void *buf, size_t len) {
+ if (r->flags & RIO_FLAG_READ_ERROR) return 0;
while (len) {
size_t bytes_to_read = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len;
if (r->read(r,buf,bytes_to_read) == 0) {