read_full_config error can't abort maat_new

This commit is contained in:
liuwentan
2023-04-12 15:31:17 +08:00
parent 53cd03995d
commit e8fb0143e9
7 changed files with 216 additions and 76 deletions

View File

@@ -387,7 +387,6 @@ struct maat *maat_new(struct maat_options *opts, const char *table_info_path)
if (ret < 0) {
log_error(maat_instance->logger, MODULE_MAAT_API,
"[%s:%d] maat read full config failed", __FUNCTION__, __LINE__);
goto failed;
}
}

View File

@@ -435,8 +435,8 @@ int load_maat_json_file(struct maat *maat_instance, const char *json_filename,
}
if (!maat_instance->is_running) {
strncpy(maat_instance->json_ctx.json_file, json_filename,
sizeof(maat_instance->json_ctx.json_file));
size_t len = MIN(strlen(json_filename), sizeof(maat_instance->json_ctx.json_file));
strncpy(maat_instance->json_ctx.json_file, json_filename, len);
}
ret = stat(json_filename, &fstat_buf);

View File

@@ -478,10 +478,8 @@ void *rule_monitor_loop(void *arg)
ret = maat_read_full_config(maat_instance);
if (ret < 0) {
log_error(maat_instance->logger, MODULE_MAAT_RULE,
"[%s:%d] maat read full config failed, exit rule_monitor_loop thread.",
"[%s:%d] maat read full config failed",
__FUNCTION__, __LINE__);
pthread_mutex_unlock(&(maat_instance->background_update_mutex));
return NULL;
}
}
pthread_mutex_unlock(&(maat_instance->background_update_mutex));