Skip to content
Snippets Groups Projects
Commit 7c5a9878 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Some minor fixes

parent 947c9b16
No related branches found
No related tags found
No related merge requests found
Pipeline #7326 passed with stage
in 11 seconds
......@@ -47,6 +47,8 @@
#include "dap_strfuncs.h"
#include "dap_file_utils.h"
#define LOG_TAG "file_utils"
/**
* Check the directory path for unsupported symbols
*
......@@ -282,6 +284,7 @@ bool dap_path_is_absolute(const char *a_file_name)
*/
char* dap_path_get_dirname(const char *a_file_name)
{
log_it(L_DEBUG,"dap_path_get_dirname(a_file_name=\"%s\")", a_file_name);
char *l_base;
size_t l_len;
......@@ -313,6 +316,7 @@ char* dap_path_get_dirname(const char *a_file_name)
return dap_strdup (l_drive_colon_dot);
}
#endif
log_it(L_DEBUG,"l_base is NULL, return dup of .");
return dap_strdup(".");
}
......@@ -367,9 +371,9 @@ char* dap_path_get_dirname(const char *a_file_name)
l_len = (uint32_t) 1 + l_base - a_file_name;
l_base = DAP_NEW_SIZE(char, l_len + 1);
memmove(l_base, a_file_name, l_len);
memcpy(l_base, a_file_name, l_len);
l_base[l_len] = 0;
log_it(L_DEBUG,"l_base=%s",l_base);
return l_base;
}
......
......@@ -243,7 +243,8 @@ char* dap_strdup(const char *a_str)
size_t l_length = (size_t) (strlen(a_str) + 1);
if(l_length){
l_new_str = DAP_NEW_SIZE(char, l_length);
memcpy(l_new_str, a_str, l_length);
if(l_new_str)
memcpy(l_new_str, a_str, l_length);
}else
l_new_str = NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment