mirror of https://mirror.osredm.com/root/redis.git
Fix path copy error and add more logs. (#10324)
Since we didn't copy the null terminator to temp_filepath, dirname could return the wrong result.
This commit is contained in:
parent
65e4bce0e7
commit
4916d79fbd
|
@ -226,7 +226,7 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi
|
||||||
|
|
||||||
FILE *fp = fopen(aof_filepath, "r+");
|
FILE *fp = fopen(aof_filepath, "r+");
|
||||||
if (fp == NULL) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi
|
||||||
int fileIsRDB(char *filepath) {
|
int fileIsRDB(char *filepath) {
|
||||||
FILE *fp = fopen(filepath, "r");
|
FILE *fp = fopen(filepath, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
printf("Cannot open file: %s\n", filepath);
|
printf("Cannot open file %s: %s\n", filepath, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ int fileIsManifest(char *filepath) {
|
||||||
int is_manifest = 0;
|
int is_manifest = 0;
|
||||||
FILE *fp = fopen(filepath, "r");
|
FILE *fp = fopen(filepath, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
printf("Cannot open file: %s\n", filepath);
|
printf("Cannot open file %s: %s\n", filepath, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ int redis_check_aof_main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In the glibc implementation dirname may modify their argument. */
|
/* 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);
|
dirpath = dirname(temp_filepath);
|
||||||
|
|
||||||
/* Select the corresponding verification method according to the input file type. */
|
/* Select the corresponding verification method according to the input file type. */
|
||||||
|
|
Loading…
Reference in New Issue