preserve.bin 保存时添加 时间戳 248/1 248/head
authorSnickerSun <snickersun@163.com>
Sat, 8 Jun 2024 09:12:14 +0000 (17:12 +0800)
committerSnickerSun <snickersun@163.com>
Sat, 8 Jun 2024 09:12:14 +0000 (17:12 +0800)
code/sdk/middleware/utils/dfx/preserve/private/preserve.c

index 6325d42..7ce7fe7 100755 (executable)
@@ -106,8 +106,12 @@ static void system_set_reboot_status_by_crash_cause(void)
 #if !defined(BUILD_RECOVERY_IMAGE)
 void save_preserve_file_to_nand(void)
 {
-    const char *preserve_info_ex_path = "/user/exc/preserve.bin";
-    int32_t ret = exc_info_write(preserve_info_ex_path, 0, (uint8_t *)&g_preserve_data_lib, sizeof(preserve_data_t));
+    const char *preserve_info_ex_path = "/user/exc/preserve_%d.bin";
+    uint32_t timestamp = get_local_timestamp();
+    char *str = (char *)malloc(200);
+    memset_s(str, 200, 0, 200);
+    sprintf(str, preserve_info_ex_path, timestamp);
+    int32_t ret = exc_info_write(str, 0, (uint8_t *)&g_preserve_data_lib, sizeof(preserve_data_t));
     printf("save_preserve_file_to_nand ret:%d.\r\n", ret);
 }