#include "diagnostics/diagnostics.h"
#include "diagnostics/diagnostics_dump.h"
+#include "shared/config.h"
#include "shared/log.h"
#include "shared/util.h"
struct report_file *list = NULL;
*count = 0;
+ config_t config;
+ char *crash_root_path = NULL;
+ if (config_init(&config, CRASH_MANAGER_CONFIG_PATH))
+ crash_root_path = config.crash_root_path;
+ else
+ crash_root_path = CRASH_ROOT_PATH;
+
+ char crash_path[PATH_MAX];
+ char live_path[PATH_MAX];
+ snprintf(crash_path, sizeof(crash_path)-1, "%s%s", crash_root_path, CRASH_PATH_SUBDIR);
+ snprintf(live_path, sizeof(live_path)-1, "%s%s", crash_root_path, LIVE_PATH_SUBDIR);
const char *dirs[] = {
- CRASH_ROOT_PATH CRASH_PATH_SUBDIR,
- CRASH_ROOT_PATH LIVE_PATH_SUBDIR
+ crash_path,
+ live_path
};
for (int i = 0; i < ARRAY_SIZE(dirs); i++) {
#include "systemdump.h"
#include "defs.h"
+#include "shared/config.h"
#include "shared/spawn.h"
#include "shared/util.h"
#include "shared/log.h"
time_t time_info = time(NULL);
localtime_r(&time_info, &loc_tm);
strftime(date, sizeof(date), "%Y%m%d%H%M%S", &loc_tm);
+ config_t config;
+ const char *crash_root_path;
+ if (config_init(&config, CRASH_MANAGER_CONFIG_PATH))
+ crash_root_path = config.crash_root_path;
+ else
+ crash_root_path = CRASH_ROOT_PATH;
+
+ char *crash_temp_path;
+ if (asprintf(&crash_temp_path, "%s/temp", crash_root_path) == -1) {
+ goto out_of_memory;
+ }
- if (!make_dir(CRASH_TEMP, DEFAULT_CRASH_DIR_PERM))
+ if (!make_dir(crash_temp_path, DEFAULT_CRASH_DIR_PERM))
return false;
- if (asprintf(&sinfo->temp_path, "%s/crash.XXXXXX", CRASH_TEMP) == -1)
+ if (asprintf(&sinfo->temp_path, "%s/crash.XXXXXX", crash_temp_path) == -1)
goto out_of_memory;
if (mkdtemp(sinfo->temp_path) == NULL || access(sinfo->temp_path, F_OK)) {
if (asprintf(&sinfo->report_name, "system_0_%s", date) == -1 ||
asprintf(&sinfo->temp_report_dir, "%s/%s", sinfo->temp_path, sinfo->report_name) == -1 ||
asprintf(&sinfo->log_path, "%s/%s.log", sinfo->temp_report_dir, sinfo->report_name) == -1 ||
- asprintf(&sinfo->reports_dir, "%s%s", CRASH_ROOT_PATH, LIVE_PATH_SUBDIR) == -1 ||
+ asprintf(&sinfo->reports_dir, "%s%s", crash_root_path, LIVE_PATH_SUBDIR) == -1 ||
asprintf(&sinfo->zip_path, "%s/report.zip", sinfo->temp_path) == -1 ||
asprintf(&sinfo->report_path, "%s%s.%s", sinfo->reports_dir, sinfo->report_name, "zip") == -1)
goto out_of_memory;