#define MINICOREDUMPER_TIMEOUT 12*60
#define CRASH_STACK_TIMEOUT 12*60
+#define ZIP_TIMEOUT 12*60
#define TEMP_MAPS_FILENAME "maps.temp"
enum {
{
int ret, lock_fd;
char zip_path[PATH_MAX];
- char command[PATH_MAX];
+ char cwd[PATH_MAX];
ret = snprintf(zip_path, sizeof(zip_path), "%s/report.zip",
cinfo->temp_dir);
return;
}
- ret = snprintf(command, sizeof(command), "cd %s && /bin/zip -y -r %s %s > /dev/null 2>&1",
- cinfo->temp_dir, zip_path, cinfo->name);
- if (ret < 0) {
- _E("Failed to snprintf for zip command");
+ if (getcwd(cwd, sizeof(cwd)) == NULL) {
+ _E("getcwd() error: %m\n");
+ return;
+ }
+
+ if (chdir(cinfo->temp_dir) == -1) {
+ _E("chdir() to %s error: %m\n", cinfo->temp_dir);
+ return;
+ }
+
+ char *args[] = {
+ "/bin/zip",
+ "-y",
+ "-r",
+ zip_path,
+ cinfo->name,
+ NULL
+ };
+
+ run_command_timeout(args[0], args, NULL, ZIP_TIMEOUT);
+
+ if (chdir(cwd) == -1) {
+ _E("chdir() to %s error: %m\n", cwd);
return;
}
- system_command(command);
if ((lock_fd = lock_dumpdir()) < 0)
return;