From 34460dd6ee0c9ae6561de54f1005f493bfcc543c Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 30 Mar 2015 12:17:46 +0200 Subject: [PATCH] Check bio.c job type at thread startup. Another one just to avoid a warning. Slightly more defensive code anyway. --- src/bio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bio.c b/src/bio.c index 4bd5a17c..27bc9abf 100644 --- a/src/bio.c +++ b/src/bio.c @@ -142,6 +142,13 @@ void *bioProcessBackgroundJobs(void *arg) { unsigned long type = (unsigned long) arg; sigset_t sigset; + /* Check that the type is within the right interval. */ + if (type >= REDIS_BIO_NUM_OPS) { + redisLog(REDIS_WARNING, + "Warning: bio thread started with wrong type %lu",type); + return NULL; + } + /* Make the thread killable at any time, so that bioKillThreads() * can work reliably. */ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);