diff --git a/src/redis-check-aof.c b/src/redis-check-aof.c index d2ff21068..a3da79dd4 100644 --- a/src/redis-check-aof.c +++ b/src/redis-check-aof.c @@ -226,7 +226,7 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi FILE *fp = fopen(aof_filepath, "r+"); if (fp == NULL) { - printf("Cannot open file: %s, aborting...\n", aof_filename); + printf("Cannot open file %s: %s, aborting...\n", aof_filepath, strerror(errno)); exit(1); } @@ -336,7 +336,7 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi int fileIsRDB(char *filepath) { FILE *fp = fopen(filepath, "r"); if (fp == NULL) { - printf("Cannot open file: %s\n", filepath); + printf("Cannot open file %s: %s\n", filepath, strerror(errno)); exit(1); } @@ -372,7 +372,7 @@ int fileIsManifest(char *filepath) { int is_manifest = 0; FILE *fp = fopen(filepath, "r"); if (fp == NULL) { - printf("Cannot open file: %s\n", filepath); + printf("Cannot open file %s: %s\n", filepath, strerror(errno)); exit(1); } @@ -554,7 +554,7 @@ int redis_check_aof_main(int argc, char **argv) { } /* In the glibc implementation dirname may modify their argument. */ - memcpy(temp_filepath, filepath, strlen(filepath)); + memcpy(temp_filepath, filepath, strlen(filepath) + 1); dirpath = dirname(temp_filepath); /* Select the corresponding verification method according to the input file type. */