summaryrefslogtreecommitdiff
path: root/src/redis-check-rdb.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-07-17 17:30:02 +0200
committerantirez <antirez@gmail.com>2019-07-17 17:30:02 +0200
commit42b6305964cb3a5461402652773ceacf5dec49fd (patch)
tree99ae1465c3dd8a0963146392c9e760c844d7a6bb /src/redis-check-rdb.c
parent6b72b04a37e7a17bb1adc822d0685f6fd39886ff (diff)
downloadredis-42b6305964cb3a5461402652773ceacf5dec49fd.tar.gz
RDB: try to make error handling code more readable.diskless-short-read
Diffstat (limited to 'src/redis-check-rdb.c')
-rw-r--r--src/redis-check-rdb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c
index fd3f07b0a..5e7415046 100644
--- a/src/redis-check-rdb.c
+++ b/src/redis-check-rdb.c
@@ -212,19 +212,20 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
/* Handle special types. */
if (type == RDB_OPCODE_EXPIRETIME) {
- time_t t;
rdbstate.doing = RDB_CHECK_DOING_READ_EXPIRE;
/* EXPIRETIME: load an expire associated with the next key
* to load. Note that after loading an expire we need to
* load the actual type, and continue. */
- if (rdbLoadTime(&rdb, &t) == C_ERR) goto eoferr;
- expiretime = t * 1000;
+ expiretime = rdbLoadTime(&rdb);
+ expiretime *= 1000;
+ if (rioGetReadError(&rdb)) goto eoferr;
continue; /* Read next opcode. */
} else if (type == RDB_OPCODE_EXPIRETIME_MS) {
/* EXPIRETIME_MS: milliseconds precision expire times introduced
* with RDB v3. Like EXPIRETIME but no with more precision. */
rdbstate.doing = RDB_CHECK_DOING_READ_EXPIRE;
- if (rdbLoadMillisecondTime(&rdb, &expiretime, rdbver) == C_ERR) goto eoferr;
+ expiretime = rdbLoadMillisecondTime(&rdb, rdbver);
+ if (rioGetReadError(&rdb)) goto eoferr;
continue; /* Read next opcode. */
} else if (type == RDB_OPCODE_FREQ) {
/* FREQ: LFU frequency. */