From: Karol Lewandowski Date: Mon, 12 Aug 2019 11:54:37 +0000 (+0200) Subject: crash-manager: Janitorial: rename crash_crash_path to crash_dump_path for readability X-Git-Tag: accepted/tizen/unified/20190904.224501~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be51f6c2054edac30b31b80fa094614e018846dc;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git crash-manager: Janitorial: rename crash_crash_path to crash_dump_path for readability Change-Id: Id62ade3ac22c27360bad000b37e3e9bc53e5b254 --- diff --git a/src/crash-manager/crash-manager.c b/src/crash-manager/crash-manager.c index d746ecb..34e4c3f 100644 --- a/src/crash-manager/crash-manager.c +++ b/src/crash-manager/crash-manager.c @@ -83,7 +83,7 @@ struct file_info { /* Configuration variables */ config_t config; -static char* crash_crash_path; +static char* crash_dump_path; static char* crash_temp_path; /* Paths and variables */ @@ -206,12 +206,12 @@ static int prepare_paths(struct crash_info* cinfo) const char *crash_subdir = cinfo->livedump ? LIVE_PATH_SUBDIR : CRASH_PATH_SUBDIR; tmp_len = strlen(config.crash_root_path) + strlen(crash_subdir); - crash_crash_path = (char*)malloc(tmp_len + 1); - if (crash_crash_path == NULL) { - _E("Couldn't allocate memory for crash_crash_path: %m\n"); + crash_dump_path = (char*)malloc(tmp_len + 1); + if (crash_dump_path == NULL) { + _E("Couldn't allocate memory for crash_dump_path: %m\n"); return 0; } - snprintf(crash_crash_path, tmp_len + 1, "%s%s", config.crash_root_path, crash_subdir); + snprintf(crash_dump_path, tmp_len + 1, "%s%s", config.crash_root_path, crash_subdir); tmp_len = strlen(config.crash_root_path) + strlen(CRASH_TEMP_SUBDIR); crash_temp_path = (char*)malloc(tmp_len + 1); @@ -225,7 +225,7 @@ static int prepare_paths(struct crash_info* cinfo) static bool make_dump_dir(void) { - const char *dirs[] = {crash_crash_path, crash_temp_path}; + const char *dirs[] = {crash_dump_path, crash_temp_path}; for (size_t i = 0; i < ARRAY_SIZE(dirs); i++) { const char *dirname = dirs[i]; @@ -505,10 +505,10 @@ static int set_crash_info(struct crash_info *cinfo) if (config.allow_zip) ret = asprintf(&cinfo->result_path, - "%s/%s.zip", crash_crash_path, cinfo->name); + "%s/%s.zip", crash_dump_path, cinfo->name); else ret = asprintf(&cinfo->result_path, - "%s/%s", crash_crash_path, cinfo->name); + "%s/%s", crash_dump_path, cinfo->name); if (ret == -1) { _E("Failed to asprintf for result path"); cinfo->result_path = NULL; @@ -917,13 +917,13 @@ static int lock_dumpdir(void) { int fd; - if ((fd = open(crash_crash_path, O_RDONLY | O_DIRECTORY)) < 0) { - _E("Failed to open %s", crash_crash_path); + if ((fd = open(crash_dump_path, O_RDONLY | O_DIRECTORY)) < 0) { + _E("Failed to open %s: %m", crash_dump_path); return -1; } if (flock(fd, LOCK_EX) < 0) { - _E("Failed to flock (LOCK)"); + _E("Failed to lock %s for exclusive access: %m", crash_dump_path); close(fd); return -1; } @@ -965,12 +965,12 @@ static int scan_dump(struct file_info **dump_list, off_t *usage) int i, scan_num, dump_num = 0; int fd; - if ((fd = open(crash_crash_path, O_DIRECTORY)) < 0) { - _E("Failed to open %s", crash_crash_path); + if ((fd = open(crash_dump_path, O_DIRECTORY)) < 0) { + _E("Failed to open %s: %m", crash_dump_path); return -1; } - scan_num = scandir(crash_crash_path, &scan_list, &dump_filter, NULL); + scan_num = scandir(crash_dump_path, &scan_list, &dump_filter, NULL); if (scan_num < 0) { close(fd); return -1; @@ -990,7 +990,7 @@ static int scan_dump(struct file_info **dump_list, off_t *usage) } if (asprintf(&(temp_list[dump_num].path), "%s/%s", - crash_crash_path, scan_list[i]->d_name) < 0) { + crash_dump_path, scan_list[i]->d_name) < 0) { _E("Failed to asprintf"); continue; } @@ -1328,7 +1328,7 @@ int main(int argc, char *argv[]) } else { free(cinfo.result_path); if (asprintf(&cinfo.result_path, "%s/%s.info", - crash_crash_path, cinfo.name) == -1) { + crash_dump_path, cinfo.name) == -1) { cinfo.result_path = NULL; _E("asprintf() error: %m"); res = EXIT_FAILURE; @@ -1368,7 +1368,7 @@ exit: if (cinfo.prstatus_fd >= 0) close(cinfo.prstatus_fd); free(crash_temp_path); - free(crash_crash_path); + free(crash_dump_path); config_free(&config); free_crash_info(&cinfo);