Skip to content

Commit

Permalink
Modify clusterSaveConfig function call to use C_OK / C_ERR return val…
Browse files Browse the repository at this point in the history
…ue (#818)

Minor cleanups.

Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin authored Jul 24, 2024
1 parent 59aa008 commit f00c8f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ int clusterLoadConfig(char *filename) {

/* Cluster node configuration is exactly the same as CLUSTER NODES output.
*
* This function writes the node config and returns 0, on error -1
* This function writes the node config and returns C_OK, on error C_ERR
* is returned.
*
* Note: we need to write the file in an atomic way from the point of view
Expand Down Expand Up @@ -810,7 +810,7 @@ int clusterSaveConfig(int do_fsync) {
}

void clusterSaveConfigOrDie(int do_fsync) {
if (clusterSaveConfig(do_fsync) == -1) {
if (clusterSaveConfig(do_fsync) == C_ERR) {
serverLog(LL_WARNING, "Fatal: can't update cluster config file.");
exit(1);
}
Expand Down Expand Up @@ -6338,7 +6338,7 @@ int clusterCommandSpecial(client *c) {
} else if (!strcasecmp(c->argv[1]->ptr, "saveconfig") && c->argc == 2) {
int retval = clusterSaveConfig(1);

if (retval == 0)
if (retval == C_OK)
addReply(c, shared.ok);
else
addReplyErrorFormat(c, "error saving the cluster node config: %s", strerror(errno));
Expand Down

0 comments on commit f00c8f6

Please sign in to comment.