lib: grpc: fix handling of "empty" yang type

- rather than coerce `const char *` to std:string&, just pass the
C ptr, as that's what is used anyway.

fixes #10578

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2022-03-06 11:58:26 -05:00
parent 83f6fce7d2
commit fe095adc24

View File

@ -276,10 +276,10 @@ static LYD_FORMAT encoding2lyd_format(enum frr::Encoding encoding)
} }
static int yang_dnode_edit(struct lyd_node *dnode, const std::string &path, static int yang_dnode_edit(struct lyd_node *dnode, const std::string &path,
const std::string &value) const char *value)
{ {
LY_ERR err = lyd_new_path(dnode, ly_native_ctx, path.c_str(), LY_ERR err = lyd_new_path(dnode, ly_native_ctx, path.c_str(), value,
value.c_str(), LYD_NEW_PATH_UPDATE, &dnode); LYD_NEW_PATH_UPDATE, &dnode);
if (err != LY_SUCCESS) { if (err != LY_SUCCESS) {
flog_warn(EC_LIB_LIBYANG, "%s: lyd_new_path() failed: %s", flog_warn(EC_LIB_LIBYANG, "%s: lyd_new_path() failed: %s",
__func__, ly_errmsg(ly_native_ctx)); __func__, ly_errmsg(ly_native_ctx));
@ -706,8 +706,8 @@ void HandleUnaryEditCandidate(
auto pvs = tag->request.update(); auto pvs = tag->request.update();
for (const frr::PathValue &pv : pvs) { for (const frr::PathValue &pv : pvs) {
if (yang_dnode_edit(candidate_tmp->dnode, pv.path(), pv.value()) if (yang_dnode_edit(candidate_tmp->dnode, pv.path(),
!= 0) { pv.value().c_str()) != 0) {
nb_config_free(candidate_tmp); nb_config_free(candidate_tmp);
tag->responder.Finish( tag->responder.Finish(