diff --git a/HISTORY b/HISTORY index 6cc08f6..5017672 100644 --- a/HISTORY +++ b/HISTORY @@ -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 diff --git a/src/process_ctrl.c b/src/process_ctrl.c index 3c8631c..a1047dd 100644 --- a/src/process_ctrl.c +++ b/src/process_ctrl.c @@ -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, " \ diff --git a/src/process_ctrl.h b/src/process_ctrl.h index d5d041c..d38c446 100644 --- a/src/process_ctrl.h +++ b/src/process_ctrl.h @@ -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);