Skip to content

Commit

Permalink
move the declaration of dfd to a small scope
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin committed Nov 25, 2024
1 parent d88cfaa commit 1fe21e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1fe21e2

Please sign in to comment.