From f00c8f6214b2b3f6eec7af74cdf6485ffbb33ed3 Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 24 Jul 2024 09:58:44 +0800 Subject: [PATCH] Modify clusterSaveConfig function call to use C_OK / C_ERR return value (#818) Minor cleanups. Signed-off-by: Binbin --- src/cluster_legacy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 032f3449d7..73d484c61c 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -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 @@ -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); } @@ -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));