diff --git a/bin/src/bytrace.cpp b/bin/src/bytrace.cpp index 3f6bb59..81304d2 100755 --- a/bin/src/bytrace.cpp +++ b/bin/src/bytrace.cpp @@ -177,9 +177,15 @@ static string CanonicalizeSpecPath(const char* src) return ""; } #else - if (realpath(src, resolvedPath) == nullptr) { - fprintf(stderr, "Error: _fullpath %s failed", src); - return ""; + if (access(src, F_OK) == 0) { + if (realpath(src, resolvedPath) == nullptr) { + fprintf(stderr, "Error: _fullpath %s failed", src); + return ""; + } + } else { + if (sprintf_s(resolvedPath, PATH_MAX, "%s", src) == -1) { + return ""; + } } #endif string res(resolvedPath); diff --git a/bin/test/unittest/common/native/bytrace_ndk_test.cpp b/bin/test/unittest/common/native/bytrace_ndk_test.cpp index 3430172..b0d5f35 100755 --- a/bin/test/unittest/common/native/bytrace_ndk_test.cpp +++ b/bin/test/unittest/common/native/bytrace_ndk_test.cpp @@ -283,7 +283,7 @@ MyTrace GetTraceResult(const string& checkContent, const vector& list) regex pattern(checkContent); smatch match; Param param {""}; - for (unsigned int i = list.size() - 1; i >= 0; i--) { + for (int i = list.size() - 1; i >= 0; i--) { if (regex_match(list[i], match, pattern)) { param.m_task = match[TASK]; param.m_tid = match[TID];