From 1fe21e258df11555715b762e50bf86d37e1154d1 Mon Sep 17 00:00:00 2001 From: Binbin Date: Mon, 25 Nov 2024 21:07:59 +0800 Subject: [PATCH] move the declaration of dfd to a small scope Signed-off-by: Binbin --- src/replication.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replication.c b/src/replication.c index 3c137031f2..464f258f7f 100644 --- a/src/replication.c +++ b/src/replication.c @@ -3414,7 +3414,6 @@ void dualChannelSetupMainConnForPsync(connection *conn) { * establish a connection with the primary. */ void syncWithPrimary(connection *conn) { char tmpfile[256], *err = NULL; - int dfd = -1, maxtries = 5; int psync_result; /* If this event fired after the user turned the instance into a primary @@ -3684,6 +3683,7 @@ void syncWithPrimary(connection *conn) { /* Prepare a suitable temp file for bulk transfer */ if (!useDisklessLoad()) { + int dfd = -1, maxtries = 5; while (maxtries--) { snprintf(tmpfile, 256, "temp-%d.%ld.rdb", (int)server.unixtime, (long int)getpid()); dfd = open(tmpfile, O_CREAT | O_WRONLY | O_EXCL, 0644);