From 781d7b0d9b51d1d80097c1f6ddec6270c1532ede Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 22 Dec 2020 09:14:15 -0500 Subject: [PATCH] Sentinel: add missing calls for sentinelflushconfig when config master at runtime (#8229) --- src/sentinel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index 95cfa84ad..7693ac5ae 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -3579,14 +3579,13 @@ void sentinelSetCommand(client *c) { "Reconfiguration of scripts path is denied for " "security reasons. Check the deny-scripts-reconfig " "configuration directive in your Sentinel configuration"); - return; + goto seterr; } if (strlen(value) && access(value,X_OK) == -1) { addReplyError(c, "Notification script seems non existing or non executable"); - if (changes) sentinelFlushConfig(); - return; + goto seterr; } sdsfree(ri->notification_script); ri->notification_script = strlen(value) ? sdsnew(value) : NULL; @@ -3599,15 +3598,14 @@ void sentinelSetCommand(client *c) { "Reconfiguration of scripts path is denied for " "security reasons. Check the deny-scripts-reconfig " "configuration directive in your Sentinel configuration"); - return; + goto seterr; } if (strlen(value) && access(value,X_OK) == -1) { addReplyError(c, "Client reconfiguration script seems non existing or " "non executable"); - if (changes) sentinelFlushConfig(); - return; + goto seterr; } sdsfree(ri->client_reconfig_script); ri->client_reconfig_script = strlen(value) ? sdsnew(value) : NULL; @@ -3657,8 +3655,7 @@ void sentinelSetCommand(client *c) { } else { addReplyErrorFormat(c,"Unknown option or number of arguments for " "SENTINEL SET '%s'", option); - if (changes) sentinelFlushConfig(); - return; + goto seterr; } /* Log the event. */ @@ -3684,9 +3681,11 @@ void sentinelSetCommand(client *c) { return; badfmt: /* Bad format errors */ - if (changes) sentinelFlushConfig(); addReplyErrorFormat(c,"Invalid argument '%s' for SENTINEL SET '%s'", (char*)c->argv[badarg]->ptr,option); +seterr: + if (changes) sentinelFlushConfig(); + return; } /* Our fake PUBLISH command: it is actually useful only to receive hello messages