diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mgmt_be_client.c | 9 | ||||
| -rw-r--r-- | lib/mgmt_fe_client.c | 9 | ||||
| -rw-r--r-- | lib/mgmt_msg.c | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index 4dc7b296b8..bb45024d0e 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -819,7 +819,11 @@ static int mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx, Mgmtd__BeMessage *be_msg) { - switch (be_msg->message_case) { + /* + * protobuf-c adds a max size enum with an internal, and changing by + * version, name; cast to an int to avoid unhandled enum warnings + */ + switch ((int)be_msg->message_case) { case MGMTD__BE_MESSAGE__MESSAGE_SUBSCR_REPLY: MGMTD_BE_CLIENT_DBG("Subscribe Reply Msg from mgmt, status %u", be_msg->subscr_reply->success); @@ -861,9 +865,6 @@ mgmt_be_client_handle_msg(struct mgmt_be_client_ctx *client_ctx, case MGMTD__BE_MESSAGE__MESSAGE_SHOW_CMD_REPLY: case MGMTD__BE_MESSAGE__MESSAGE_NOTIFY_DATA: case MGMTD__BE_MESSAGE__MESSAGE__NOT_SET: -#if PROTOBUF_C_VERSION_NUMBER >= 1003000 - case _MGMTD__BE_MESSAGE__MESSAGE_IS_INT_SIZE: -#endif default: /* * A 'default' case is being added contrary to the diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index 73154401ec..3624922124 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -428,7 +428,11 @@ mgmt_fe_client_handle_msg(struct mgmt_fe_client_ctx *client_ctx, { struct mgmt_fe_client_session *session = NULL; - switch (fe_msg->message_case) { + /* + * protobuf-c adds a max size enum with an internal, and changing by + * version, name; cast to an int to avoid unhandled enum warnings + */ + switch ((int)fe_msg->message_case) { case MGMTD__FE_MESSAGE__MESSAGE_SESSION_REPLY: if (fe_msg->session_reply->create && fe_msg->session_reply->has_client_conn_id) { @@ -634,9 +638,6 @@ mgmt_fe_client_handle_msg(struct mgmt_fe_client_ctx *client_ctx, case MGMTD__FE_MESSAGE__MESSAGE_GETCFG_REQ: case MGMTD__FE_MESSAGE__MESSAGE_GETDATA_REQ: case MGMTD__FE_MESSAGE__MESSAGE__NOT_SET: -#if PROTOBUF_C_VERSION_NUMBER >= 1003000 - case _MGMTD__FE_MESSAGE__MESSAGE_IS_INT_SIZE: -#endif default: /* * A 'default' case is being added contrary to the diff --git a/lib/mgmt_msg.c b/lib/mgmt_msg.c index d212fef92c..2fab03bc54 100644 --- a/lib/mgmt_msg.c +++ b/lib/mgmt_msg.c @@ -56,7 +56,7 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd, */ while (avail > sizeof(struct mgmt_msg_hdr)) { n = stream_read_try(ms->ins, fd, avail); - MGMT_MSG_DBG(dbgtag, "got %ld bytes", n); + MGMT_MSG_DBG(dbgtag, "got %zd bytes", n); /* -2 is normal nothing read, and to retry */ if (n == -2) @@ -85,7 +85,7 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd, MGMT_MSG_DBG(dbgtag, "recv corrupt buffer, disconnect"); return MSR_DISCONNECT; } - if (mhdr->len > left) + if ((ssize_t)mhdr->len > left) break; MGMT_MSG_DBG(dbgtag, "read full message len %u", mhdr->len); |
