Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
74590f83
Unverified
Commit
74590f83
authored
Aug 22, 2021
by
Viktor Söderqvist
Committed by
GitHub
Aug 22, 2021
Browse files
redis-cli: Assert > 0 before dividing, to silence warning by tool (#9396)
Also make sure function can't return NULL by another assert.
parent
0835f596
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
74590f83
...
...
@@ -4679,6 +4679,7 @@ static clusterManagerNode *clusterManagerNodeMasterRandom() {
master_count
++
;
}
assert
(
master_count
>
0
);
srand
(
time
(
NULL
));
idx
=
rand
()
%
master_count
;
listRewind
(
cluster_manager
.
nodes
,
&
li
);
...
...
@@ -4690,7 +4691,7 @@ static clusterManagerNode *clusterManagerNodeMasterRandom() {
}
}
/* Can not be reached */
return
NULL
;
assert
(
0
)
;
}
static
int
clusterManagerFixSlotsCoverage
(
char
*
all_slots
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment