get_base_path_from_conf_file_ex support parameter: noent_log_level

remotes/origin/fstore_storage_engine
YuQing 2022-09-21 11:35:32 +08:00
parent 6b70919699
commit 47fb7b2abd
3 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,7 @@
Version 1.61 2022-09-21
* get_base_path_from_conf_file_ex support parameter: noent_log_level
Version 1.60 2022-08-27
* normalize_path for base_path
* struct fast_task_info add field recv_body for dynamic recv buffer

View File

@ -274,8 +274,8 @@ int process_exist(const char *pidFilename, pid_t *pid)
}
}
int get_base_path_from_conf_file(const char *filename, char *base_path,
const int path_size)
int get_base_path_from_conf_file_ex(const char *filename, char *base_path,
const int path_size, const int noent_log_level)
{
char *pBasePath;
IniContext iniContext;
@ -306,13 +306,14 @@ int get_base_path_from_conf_file(const char *filename, char *base_path,
normalize_path(NULL, pBasePath, base_path, path_size);
chopPath(base_path);
if (!fileExists(base_path))
{
logError("file: "__FILE__", line: %d, " \
"\"%s\" can't be accessed, error info: %s", \
__LINE__, base_path, STRERROR(errno));
result = errno != 0 ? errno : ENOENT;
break;
}
{
result = errno != 0 ? errno : ENOENT;
log_it_ex(&g_log_context, noent_log_level,
"file: "__FILE__", line: %d, "
"\"%s\" can't be accessed, error info: %s",
__LINE__, base_path, STRERROR(result));
break;
}
if (!isDir(base_path))
{
logError("file: "__FILE__", line: %d, " \

View File

@ -27,8 +27,11 @@
extern "C" {
#endif
int get_base_path_from_conf_file(const char *filename, char *base_path,
const int path_size);
int get_base_path_from_conf_file_ex(const char *filename, char *base_path,
const int path_size, const int noent_log_level);
#define get_base_path_from_conf_file(filename, base_path, path_size) \
get_base_path_from_conf_file_ex(filename, base_path, path_size, LOG_ERR)
int get_pid_from_file(const char *pidFilename, pid_t *pid);