summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-03-04 12:55:49 +0100
committerantirez <antirez@gmail.com>2020-03-04 12:55:49 +0100
commitd16bb64fa4522ea814d5eda71dc81a36f74716e6 (patch)
tree6ca205a6d810e5f43235d2189a5ed614183a7535
parentff024e3064b392018623209279284568caff899e (diff)
downloadredis-d16bb64fa4522ea814d5eda71dc81a36f74716e6.tar.gz
Check that the file exists in removeRDBUsedToSyncReplicas().
-rw-r--r--src/replication.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/replication.c b/src/replication.c
index acecdd098..20666bd20 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -944,10 +944,14 @@ void removeRDBUsedToSyncReplicas(void) {
}
}
if (delrdb) {
- serverLog(LL_NOTICE,"Removing the RDB file used to feed replicas "
- "in a persistence-less instance");
- RDBGeneratedByReplication = 0;
- bg_unlink(server.rdb_filename);
+ struct stat sb;
+ if (lstat(server.rdb_filename,&sb) != -1) {
+ RDBGeneratedByReplication = 0;
+ serverLog(LL_NOTICE,
+ "Removing the RDB file used to feed replicas "
+ "in a persistence-less instance");
+ bg_unlink(server.rdb_filename);
+ }
}
}
}