From 25d32fce146aaaf149021692cef878f54e65f07a 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 | 5 +++++ lib/tlog/rec_conf.c | 5 +++++ lib/tlog/rec_session_conf.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/lib/tlog/play_conf.c b/lib/tlog/play_conf.c index 40585823..f99507e9 100644 --- a/lib/tlog/play_conf.c +++ b/lib/tlog/play_conf.c @@ -136,6 +136,11 @@ 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..298f374d 100644 --- a/lib/tlog/rec_conf.c +++ b/lib/tlog/rec_conf.c @@ -250,6 +250,11 @@ 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..4a7d316e 100644 --- a/lib/tlog/rec_session_conf.c +++ b/lib/tlog/rec_session_conf.c @@ -265,6 +265,12 @@ 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;