summaryrefslogtreecommitdiffstats
path: root/src/redis-check-aof.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/redis-check-aof.c')
-rw-r--r--src/redis-check-aof.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/redis-check-aof.c b/src/redis-check-aof.c
index 616177a..e28126d 100644
--- a/src/redis-check-aof.c
+++ b/src/redis-check-aof.c
@@ -233,6 +233,7 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi
struct redis_stat sb;
if (redis_fstat(fileno(fp),&sb) == -1) {
printf("Cannot stat file: %s, aborting...\n", aof_filename);
+ fclose(fp);
exit(1);
}
@@ -343,6 +344,7 @@ int fileIsRDB(char *filepath) {
struct redis_stat sb;
if (redis_fstat(fileno(fp), &sb) == -1) {
printf("Cannot stat file: %s\n", filepath);
+ fclose(fp);
exit(1);
}
@@ -379,6 +381,7 @@ int fileIsManifest(char *filepath) {
struct redis_stat sb;
if (redis_fstat(fileno(fp), &sb) == -1) {
printf("Cannot stat file: %s\n", filepath);
+ fclose(fp);
exit(1);
}
@@ -395,15 +398,20 @@ int fileIsManifest(char *filepath) {
break;
} else {
printf("Cannot read file: %s\n", filepath);
+ fclose(fp);
exit(1);
}
}
- /* Skip comments lines */
+ /* We will skip comments lines.
+ * At present, the manifest format is fixed, see aofInfoFormat.
+ * We will break directly as long as it encounters other items. */
if (buf[0] == '#') {
continue;
} else if (!memcmp(buf, "file", strlen("file"))) {
is_manifest = 1;
+ } else {
+ break;
}
}