Skip to content

Commit

Permalink
mgmtd: fix a couple compilation warnings.
Browse files Browse the repository at this point in the history
Also an empty (thus non-replace) notify selectors message shouldn't
clear the selectors, it should just do nothing.

Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Aug 18, 2024
1 parent fa50fde commit e7fc74a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/mgmt_be_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ static void be_client_handle_notify(struct mgmt_be_client *client, void *msgbuf,
struct mgmt_msg_notify_data *notif_msg = msgbuf;
struct nb_node *nb_node;
struct lyd_node *dnode;
const char *data;
const char *data = NULL;
const char *notif;
LY_ERR err;

Expand Down
3 changes: 1 addition & 2 deletions mgmtd/mgmt_fe_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,6 @@ static void fe_adapter_handle_notify_select(struct mgmt_fe_session_ctx *session,
const char **selectors = NULL;
const char **new;

/* An empty message clears the selectors */
if (msg_len >= sizeof(*msg)) {
selectors = mgmt_msg_native_strings_decode(msg, msg_len,
msg->selectors);
Expand All @@ -1531,7 +1530,7 @@ static void fe_adapter_handle_notify_select(struct mgmt_fe_session_ctx *session,
if (msg->replace) {
darr_free_free(session->notify_xpaths);
session->notify_xpaths = selectors;
} else {
} else if (selectors) {
new = darr_append_nz(session->notify_xpaths,
darr_len(selectors));
memcpy(new, selectors, darr_len(selectors) * sizeof(*selectors));
Expand Down

0 comments on commit e7fc74a

Please sign in to comment.