From 89e2e027243936b6a6c2720f557118e388eef87b Mon Sep 17 00:00:00 2001 From: danghai Date: Wed, 21 Mar 2018 11:40:41 -0700 Subject: [PATCH] Make configuration validation function return validation error message --- lib/tlog/play_conf.c | 7 +++++++ lib/tlog/rec_conf.c | 7 +++++++ lib/tlog/rec_session_conf.c | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/lib/tlog/play_conf.c b/lib/tlog/play_conf.c index 40585823..87e478e5 100644 --- a/lib/tlog/play_conf.c +++ b/lib/tlog/play_conf.c @@ -75,6 +75,9 @@ tlog_play_conf_load(struct tlog_errs **perrs, assert(pcmd_help != NULL); assert(pconf != NULL); assert(argv != NULL); + /* Check validate the config */ + assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); /* Create empty config */ conf = json_object_new_object(); @@ -136,6 +139,10 @@ tlog_play_conf_load(struct tlog_errs **perrs, json_object_put(overlay); overlay = NULL; + /* Check validate the config */ + assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); + grc = TLOG_RC_OK; *pcmd_help = cmd_help; cmd_help = NULL; diff --git a/lib/tlog/rec_conf.c b/lib/tlog/rec_conf.c index c518562e..d0c6296c 100644 --- a/lib/tlog/rec_conf.c +++ b/lib/tlog/rec_conf.c @@ -175,6 +175,9 @@ tlog_rec_conf_load(struct tlog_errs **perrs, assert(pcmd_help != NULL); assert(pconf != NULL); assert(argv != NULL); + /* Check validate the config */ + assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); /* Create empty config */ conf = json_object_new_object(); @@ -250,6 +253,10 @@ tlog_rec_conf_load(struct tlog_errs **perrs, json_object_put(overlay); overlay = NULL; + /* Check validate the config */ + assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); + grc = TLOG_RC_OK; *pcmd_help = cmd_help; cmd_help = NULL; diff --git a/lib/tlog/rec_session_conf.c b/lib/tlog/rec_session_conf.c index ad6276e8..61438588 100644 --- a/lib/tlog/rec_session_conf.c +++ b/lib/tlog/rec_session_conf.c @@ -189,6 +189,9 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs, assert(pcmd_help != NULL); assert(pconf != NULL); assert(argv != NULL); + /* Check validate the config */ + assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); /* Create empty config */ conf = json_object_new_object(); @@ -265,6 +268,10 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs, json_object_put(overlay); overlay = NULL; + /* Check validate the config */ + assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) == + TLOG_RC_OK); + grc = TLOG_RC_OK; *pcmd_help = cmd_help; cmd_help = NULL;