Name: crash-worker
Summary: Coredump handler and report generator for Tizen
-Version: 9.0.3
+Version: 9.0.4
Release: 1
Group: Framework/system
License: MIT
#include "bugreport-service.h"
#include "crash-manager/crash-manager.h"
+#include "shared/config.h"
#include "shared/bugreport-util.h"
#include "shared/log.h"
#include "shared/util.h"
#define TIMEOUT_INTERVAL_SEC 60
#define TIMEOUT_LIVEDUMP_SEC 50
+static config_t config;
+const config_t *g_config = NULL;
+
static GMainLoop *loop;
static GMutex timeout_mutex;
static guint timeout_id;
int main(void)
{
+ int res = EXIT_SUCCESS;
/* Have consinsent umask across invocations - from shell, bugreport-service, kernel */
umask(DEFAULT_UMASK);
+ if (config_init(&config, CRASH_MANAGER_CONFIG_PATH)) {
+ g_config = &config;
+ }
+
loop = g_main_loop_new(NULL, false);
if (!dbus_init()) {
g_main_loop_unref(loop);
- return EXIT_FAILURE;
+ res = EXIT_FAILURE;
+ goto exit;
}
g_mutex_init(&timeout_mutex);
g_mutex_clear(&timeout_mutex);
g_main_loop_unref(loop);
- return EXIT_SUCCESS;
+
+exit:
+ if (g_config) {
+ config_free(&config);
+ g_config = NULL;
+ }
+
+ return res;
}
#include "shared/log.h"
#include "shared/util.h"
+extern const config_t *g_config;
+
enum BUGREPORT_REPORT_TYPE { BR_UNKNOWN, BR_BUGREPORT, BR_CRASHINFO, BR_CRASHINFO_JSON, BR_COREDUMP_TAR, BR_FULLREPORT, BR_PID };
struct report_file {
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_root_path = config_get_crash_root_path(g_config);
char crash_path[PATH_MAX];
char live_path[PATH_MAX];
#include <stdio.h>
#include <string.h>
#include <libbugreport.h>
+#include <limits.h>
#include "bugreport-service.h"
#define DUMP_SYSTEMSTATE_TIMEOUT_MS 1000*60*2
+extern const config_t *g_config;
+
struct systemstate_info {
char *report_name;
char *log_path;
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;
- }
+ const char *crash_root_path = config_get_crash_root_path(g_config);
+
+ char crash_temp_path[PATH_MAX];
+ snprintf(crash_temp_path, sizeof(crash_temp_path)-1, "%s/temp", crash_root_path);
if (!make_dir(crash_temp_path, DEFAULT_CRASH_DIR_PERM))
return false;
memset(c, 0, sizeof(*c));
}
+
+char *config_get_crash_root_path(const config_t *config)
+{
+ if (config) {
+ return config->crash_root_path;
+ }
+ return CRASH_ROOT_PATH;
+}
void config_free(config_t *c);
bool config_is_path_excluded(config_t *c, const char *const path);
+char *config_get_crash_root_path(const config_t *config);
#ifdef __cplusplus
}