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;