return -1;
}
+void get_proc_name(const char *cmd_line, char *buff, size_t buff_len)
+{
+ assert(buff != NULL);
+ char *space = strchr(cmd_line, ' ');
+ size_t name_len;
+
+ if (space == NULL)
+ name_len = strlen(cmd_line);
+ else
+ name_len = space - cmd_line;
+
+ if (name_len > buff_len - 1)
+ name_len = buff_len - 1;
+
+ strncpy(buff, cmd_line, name_len);
+
+ buff[name_len] = '\0';
+}
static void set_crash_info_defaults(struct crash_info *cinfo)
{
return false;
}
+ char proc_name[PATH_MAX];
+ get_proc_name(cinfo->cmd_line, proc_name, sizeof(proc_name));
const char *suffix = config.report_type >= REP_TYPE_FULL ? (config.allow_zip ? ".zip" : "") : ".info";
bool is_app = set_appinfo(cinfo->cmd_line, &cinfo->appid, &cinfo->pkgid);
if (!cinfo->appid || !cinfo->pkgid)
goto out_oom;
- if (-1 == asprintf(&cinfo->name, "%s_%d_%s", is_app ? cinfo->pkgid : basename(cinfo->cmd_path), cinfo->pid_info, date)
+ if (-1 == asprintf(&cinfo->name, "%s_%d_%s", is_app ? cinfo->pkgid : basename(proc_name), cinfo->pid_info, date)
|| -1 == asprintf(&cinfo->pfx, "%s/%s", cinfo->temp_dir, cinfo->name)
|| -1 == asprintf(&cinfo->info_path, "%s/%s.info", cinfo->pfx, cinfo->name)
|| -1 == asprintf(&cinfo->core_path, "%s/%s.coredump", cinfo->pfx, cinfo->name)
const char *without_core_str = config.dump_core ? NULL : "-s";
+ char proc_name[PATH_MAX];
+ get_proc_name(cinfo->cmd_line, proc_name, sizeof(proc_name));
+
/* Execute minicoredumper */
char *args[] = {
MINICOREDUMPER_BIN_PATH, // minicoredumper filename path
sig_str, // %s - number of signal
time_str, // %t - time of dump
"localhost", // %h - hostname
- basename(cinfo->cmd_path), // %e - exe name (need for result filename)
+ basename(proc_name), // %e - exe name (need for result filename)
MINICOREDUMPER_CONFIG_PATH, // config file
"-d",
cinfo->pfx, // temp dir