summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2019-08-12 13:54:37 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2019-08-23 10:38:23 +0200
commitbe51f6c2054edac30b31b80fa094614e018846dc (patch)
tree9229ee7a14ee27c327f058c040afec2ffd8ad9c0
parent05912c4a395168eedf1c46975e277220f1b59978 (diff)
downloadcrash-worker-be51f6c2054edac30b31b80fa094614e018846dc.tar.gz
crash-worker-be51f6c2054edac30b31b80fa094614e018846dc.tar.bz2
crash-worker-be51f6c2054edac30b31b80fa094614e018846dc.zip
crash-manager: Janitorial: rename crash_crash_path to crash_dump_path for readability
Change-Id: Id62ade3ac22c27360bad000b37e3e9bc53e5b254
-rw-r--r--src/crash-manager/crash-manager.c34
1 files changed, 17 insertions, 17 deletions
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);