summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2022-03-06 11:58:26 -0500
committermergify-bot <noreply@mergify.com>2022-03-07 19:49:18 +0000
commit5547b4a3293008ea48d179dc1f8590b5a3fcfc83 (patch)
treeaff7a257105eb3f17f3f3018d377b6ef3695a1f7
parentad748cf74f45f9159c12bb426ded1f70b48dedab (diff)
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> (cherry picked from commit fe095adc24a91eef3265ac803bb805cd297b3522)
-rw-r--r--lib/northbound_grpc.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp
index ca253031f4..f5c2a91a50 100644
--- a/lib/northbound_grpc.cpp
+++ b/lib/northbound_grpc.cpp
@@ -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,
- const std::string &value)
+ const char *value)
{
- LY_ERR err = lyd_new_path(dnode, ly_native_ctx, path.c_str(),
- value.c_str(), LYD_NEW_PATH_UPDATE, &dnode);
+ LY_ERR err = lyd_new_path(dnode, ly_native_ctx, path.c_str(), value,
+ LYD_NEW_PATH_UPDATE, &dnode);
if (err != LY_SUCCESS) {
flog_warn(EC_LIB_LIBYANG, "%s: lyd_new_path() failed: %s",
__func__, ly_errmsg(ly_native_ctx));
@@ -706,8 +706,8 @@ void HandleUnaryEditCandidate(
auto pvs = tag->request.update();
for (const frr::PathValue &pv : pvs) {
- if (yang_dnode_edit(candidate_tmp->dnode, pv.path(), pv.value())
- != 0) {
+ if (yang_dnode_edit(candidate_tmp->dnode, pv.path(),
+ pv.value().c_str()) != 0) {
nb_config_free(candidate_tmp);
tag->responder.Finish(