summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-30 12:17:46 +0200
committerantirez <antirez@gmail.com>2015-03-30 12:17:46 +0200
commit34460dd6ee0c9ae6561de54f1005f493bfcc543c (patch)
tree0e4deb6c3407a4492a7f5f8b67a25838920cce3b
parent221d2932b51dc605130130369301c92f34336987 (diff)
downloadredis-34460dd6ee0c9ae6561de54f1005f493bfcc543c.tar.gz
Check bio.c job type at thread startup.
Another one just to avoid a warning. Slightly more defensive code anyway.
-rw-r--r--src/bio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bio.c b/src/bio.c
index 4bd5a17c6..27bc9abfc 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);