未验证 提交 50dc355d 编写于 作者: D Dahan Gong 提交者: GitHub

fix TENGINE_DUMP_DIR might not be treated as dir name (#1283)

上级 18166afc
......@@ -533,11 +533,11 @@ void extract_feature_from_tensor(const char* comment, const char* layer_name, co
const char* env_path = getenv(TENGINE_DUMP_DIR);
if (NULL != env_path && (256 - 2) > strlen(env_path))
if (NULL != env_path && '\0' != env_path[0] && (256 - 2) > strlen(env_path))
{
strcpy(save_dir, env_path);
if ('/' == save_dir[strlen(env_path)] || '\\' == save_dir[strlen(env_path)])
if ('/' == save_dir[strlen(env_path) - 1] || '\\' == save_dir[strlen(env_path) - 1])
{
#ifdef _MSC_VER
save_dir[strlen(env_path)] = '\\';
......
......@@ -518,11 +518,11 @@ void extract_feature_from_tensor_odla(const char* comment, const char* layer_nam
const char* env_path = getenv(TENGINE_DUMP_DIR);
if (NULL != env_path && (256 - 2) > strlen(env_path))
if (NULL != env_path && '\0' != env_path[0] && (256 - 2) > strlen(env_path))
{
strcpy(save_dir, env_path);
if ('/' == save_dir[strlen(env_path)] || '\\' == save_dir[strlen(env_path)])
if ('/' == save_dir[strlen(env_path) - 1] || '\\' == save_dir[strlen(env_path) - 1])
{
#ifdef _MSC_VER
save_dir[strlen(env_path)] = '\\';
......
......@@ -458,11 +458,11 @@ void extract_feature_from_tensor_timvx(const char* comment, const char* layer_na
const char* env_path = getenv(TENGINE_DUMP_DIR);
if (NULL != env_path && (256 - 2) > strlen(env_path))
if (NULL != env_path && '\0' != env_path[0] && (256 - 2) > strlen(env_path))
{
strcpy(save_dir, env_path);
if ('/' == save_dir[strlen(env_path)] || '\\' == save_dir[strlen(env_path)])
if ('/' == save_dir[strlen(env_path) - 1] || '\\' == save_dir[strlen(env_path) - 1])
{
#ifdef _MSC_VER
save_dir[strlen(env_path)] = '\\';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册