From 33b824137e4d86e69e50cd7843695af8bec8dff1 Mon Sep 17 00:00:00 2001 From: Binbin Date: Sat, 4 Jan 2025 10:47:32 +0800 Subject: [PATCH] Explicitly check C_ERR condition to improve readability in clusterSaveConfig (#1505) It's not obvious to see it at first, modify it to use C_ERR. Signed-off-by: Binbin --- src/cluster_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index a1b1d0e986..807488b57d 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -868,7 +868,7 @@ int clusterSaveConfig(int do_fsync) { cleanup: if (fd != -1) close(fd); - if (retval) unlink(tmpfilename); + if (retval == C_ERR) unlink(tmpfilename); sdsfree(tmpfilename); sdsfree(ci); return retval;