Fix cluster human_nodename Getter data loss in nodes.conf (#12325)

auxHumanNodenameGetter limited to %.40s, since we did not limit the
length of config cluster-announce-human-nodename, %.40s will cause
nodename data loss (we will persist it in nodes.conf).

Additional modified auxHumanNodenamePresent to use sdslen.
This commit is contained in:
Binbin 2023-06-20 08:13:18 +08:00 committed by GitHub
parent b510624978
commit cd4f3e20c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,11 +240,11 @@ int auxHumanNodenameSetter(clusterNode *n, void *value, int length) {
} }
sds auxHumanNodenameGetter(clusterNode *n, sds s) { sds auxHumanNodenameGetter(clusterNode *n, sds s) {
return sdscatprintf(s, "%.40s", n->human_nodename); return sdscatprintf(s, "%s", n->human_nodename);
} }
int auxHumanNodenamePresent(clusterNode *n) { int auxHumanNodenamePresent(clusterNode *n) {
return strlen(n->human_nodename); return sdslen(n->human_nodename);
} }
/* clusterLink send queue blocks */ /* clusterLink send queue blocks */