소스 검색

commit crash code free(inputjson) 2

DevYK 3 년 전
부모
커밋
971966092b
2개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 1
      CMakeLists.txt
  2. 5 4
      src/utils/video_similarity.cpp

+ 2 - 1
CMakeLists.txt

@@ -182,7 +182,8 @@ if (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
             ${FFmpeg_LIBS}
             )
     add_executable(test_md5 md5_main.cpp
-            ${UTILS_SRC}
+            src/utils/md5.h
+            src/utils/md5.c
             )
     add_executable(video_similarity_comparison src/video_similarity_comparison.cpp
             ${OpenCV_SRC}

+ 5 - 4
src/utils/video_similarity.cpp

@@ -16,11 +16,12 @@ void sig_crash(int sig) {
     printf("crash---->sig=%d \n",sig);
     FILE *fd;
     struct stat buf;
-    stat("./crash.log", &buf);
+    const char * crash_path = "./video_similarity_comparison_crash.txt";
+    stat(crash_path, &buf);
     if (buf.st_size > 10 * 1000 * 1000) { // 超过10兆则清空内容
-        fd = fopen("/datalog/crash.log", "w");
+        fd = fopen(crash_path, "w");
     } else {
-        fd = fopen("/datalog/crash.log", "at");
+        fd = fopen(crash_path, "at");
     }
 
     if (NULL == fd) {
@@ -61,7 +62,7 @@ void sig_crash(int sig) {
             size_t pos2 = symbol.find_last_of("]");
             std::string address = symbol.substr(pos1 + 1, pos2 - pos1 -1);
             char cmd[128] = {0, };
-            sprintf(cmd, "addr2line -e test %s", address.c_str()); // test为应用程序名称,需要改为用户自己的应用程序名
+            sprintf(cmd, "addr2line -e video_similarity_comparison %s", address.c_str()); // test为应用程序名称,需要改为用户自己的应用程序名
             FILE *fPipe = popen(cmd, "r");
             if(fPipe != NULL){
                 char buff[1024];