_E("Failed to delete temp directory");
}
-static void move_dump_dir(const struct crash_info *cinfo)
+static void move_dump_data(const char *from_path, const struct crash_info *cinfo)
{
int lock_fd;
if ((lock_fd = lock_dumpdir()) < 0)
return;
- if (!rename(cinfo->pfx, cinfo->result_path))
+ if (!rename(from_path, cinfo->result_path))
clean_dump();
else
_E("Failed to move %s to %s",
- cinfo->pfx, cinfo->result_path);
+ from_path, cinfo->result_path);
unlock_dumpdir(lock_fd);
if (remove_dir(cinfo->temp_dir, 1) < 0)
_E("Failed to delete temp directory");
}
-static void move_info_file(struct crash_info *cinfo)
-{
- int lock_fd;
-
- if ((lock_fd = lock_dumpdir()) < 0)
- return;
-
- snprintf(cinfo->result_path, sizeof(cinfo->result_path), "%s/%s.info",
- crash_crash_path, cinfo->name);
- if (!rename(cinfo->info_path, cinfo->result_path))
- clean_dump();
- else
- _E("Failed to move %s to %s",
- cinfo->info_path, cinfo->result_path);
-
- unlock_dumpdir(lock_fd);
- if (remove_dir(cinfo->temp_dir, 1) < 0)
- _E("Failed to delete temp directory");
-}
-
static int wait_for_opt(unsigned int timeout)
{
unsigned int count = 0;
if (allow_zip)
compress(&cinfo);
else
- move_dump_dir(&cinfo);
+ move_dump_data(cinfo.pfx, &cinfo);
} else {
- move_info_file(&cinfo);
+ snprintf(cinfo.result_path, sizeof(cinfo.result_path), "%s/%s.info",
+ crash_crash_path, cinfo.name);
+ move_dump_data(cinfo.info_path, &cinfo);
}
/* launch crash-popup only if the .debugmode file is exist*/
if (debug_mode)