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
20377a6f
Unverified
Commit
20377a6f
authored
Mar 08, 2021
by
Pavlo Yatsukhnenko
Committed by
GitHub
Mar 08, 2021
Browse files
Wrong usage sdscatprintf in redis-cli. (#8604)
The result of `sdscatprintf` is doubled when using argument twice.
parent
f491eee2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
20377a6f
...
@@ -2953,8 +2953,12 @@ static int clusterManagerGetAntiAffinityScore(clusterManagerNodeArray *ipnodes,
...
@@ -2953,8 +2953,12 @@ static int clusterManagerGetAntiAffinityScore(clusterManagerNodeArray *ipnodes,
else
types
=
sdsempty
();
else
types
=
sdsempty
();
/* Master type 'm' is always set as the first character of the
/* Master type 'm' is always set as the first character of the
* types string. */
* types string. */
if
(
!
node
->
replicate
)
types
=
sdscatprintf
(
types
,
"m%s"
,
types
);
if
(
node
->
replicate
)
types
=
sdscat
(
types
,
"s"
);
else
types
=
sdscat
(
types
,
"s"
);
else
{
sds
s
=
sdscatsds
(
sdsnew
(
"m"
),
types
);
sdsfree
(
types
);
types
=
s
;
}
dictReplace
(
related
,
key
,
types
);
dictReplace
(
related
,
key
,
types
);
}
}
/* Now it's trivial to check, for each related group having the
/* Now it's trivial to check, for each related group having the
...
...
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