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 Version 1.60 2022-08-27
* normalize_path for base_path * normalize_path for base_path
* struct fast_task_info add field recv_body for dynamic recv buffer * 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, int get_base_path_from_conf_file_ex(const char *filename, char *base_path,
const int path_size) const int path_size, const int noent_log_level)
{ {
char *pBasePath; char *pBasePath;
IniContext iniContext; 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); normalize_path(NULL, pBasePath, base_path, path_size);
chopPath(base_path); chopPath(base_path);
if (!fileExists(base_path)) if (!fileExists(base_path))
{ {
logError("file: "__FILE__", line: %d, " \ result = errno != 0 ? errno : ENOENT;
"\"%s\" can't be accessed, error info: %s", \ log_it_ex(&g_log_context, noent_log_level,
__LINE__, base_path, STRERROR(errno)); "file: "__FILE__", line: %d, "
result = errno != 0 ? errno : ENOENT; "\"%s\" can't be accessed, error info: %s",
break; __LINE__, base_path, STRERROR(result));
} break;
}
if (!isDir(base_path)) if (!isDir(base_path))
{ {
logError("file: "__FILE__", line: %d, " \ logError("file: "__FILE__", line: %d, " \

View File

@ -27,8 +27,11 @@
extern "C" { extern "C" {
#endif #endif
int get_base_path_from_conf_file(const char *filename, char *base_path, int get_base_path_from_conf_file_ex(const char *filename, char *base_path,
const int path_size); 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); int get_pid_from_file(const char *pidFilename, pid_t *pid);