summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2020-09-24 15:18:14 +0800
committeryangwei <[email protected]>2020-09-24 15:18:14 +0800
commit2e4e4dff17677c44b53b2969a323eaa3465e78ee (patch)
tree0ad149922650b7d9d510a760ded8e0434a41e31b
parent150255033c4d4312ad16da83b7c4d0ad039f86ad (diff)
🐞fix(creat_dir): 修复计算待创建目录不包含/时长度计算错误的bugv2.0.5
-rw-r--r--src/MESA_handle_logger.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c
index 2960b3f..cc47733 100644
--- a/src/MESA_handle_logger.c
+++ b/src/MESA_handle_logger.c
@@ -173,7 +173,6 @@ void *MESA_create_runtime_log_handle(const char *file_path, int level)
char handle_name[MAX_HANDLE_LOG_PATH];
char *p_path_end = rindex(file_path, '/');
-
char *p_name = p_path_end+1;
strcpy(handle_name, file_path);
@@ -181,10 +180,12 @@ void *MESA_create_runtime_log_handle(const char *file_path, int level)
p_name = handle_name;
- //creating file_path failed, return NULL
- if (create_path(file_path, p_path_end - file_path) < 0)
- return NULL;
-
+ if(p_path_end != NULL && p_path_end > file_path)
+ {
+ //creating file_path failed, return NULL
+ if (create_path(file_path, p_path_end-file_path) < 0)
+ return NULL;
+ }
snapshot_handle_info(p_name, file_path, level);
zlog_reload(NULL);
zc = zlog_get_category(p_name);