#include <rte_alarm.h>
#include <rte_errno.h>
+#include <rte_string_fns.h>
#include "eal_memalloc.h"
memset(&reply, 0, sizeof(reply));
reply.num_fds = 0;
- snprintf(reply.name, sizeof(reply.name), "%s", msg->name);
+ strlcpy(reply.name, msg->name, sizeof(reply.name));
reply.len_param = sizeof(*resp);
ret = eal_memalloc_sync_with_primary();
/* send failure message straight away */
resp_msg.num_fds = 0;
resp_msg.len_param = sizeof(*resp);
- snprintf(resp_msg.name, sizeof(resp_msg.name), "%s",
- MP_ACTION_RESPONSE);
+ strlcpy(resp_msg.name, MP_ACTION_RESPONSE,
+ sizeof(resp_msg.name));
resp->t = m->t;
resp->result = REQ_RESULT_FAIL;
/* we can do something, so send sync request asynchronously */
sr_msg.num_fds = 0;
sr_msg.len_param = sizeof(*sr);
- snprintf(sr_msg.name, sizeof(sr_msg.name), "%s",
- MP_ACTION_SYNC);
+ strlcpy(sr_msg.name, MP_ACTION_SYNC, sizeof(sr_msg.name));
ts.tv_nsec = 0;
ts.tv_sec = MP_TIMEOUT_S;
resp->id = entry->user_req.id;
msg.num_fds = 0;
msg.len_param = sizeof(*resp);
- snprintf(msg.name, sizeof(msg.name), "%s", MP_ACTION_RESPONSE);
+ strlcpy(msg.name, MP_ACTION_RESPONSE, sizeof(msg.name));
if (rte_mp_sendmsg(&msg))
RTE_LOG(ERR, EAL, "Could not send message to secondary process\n");
resp->id = entry->user_req.id;
msg.num_fds = 0;
msg.len_param = sizeof(*resp);
- snprintf(msg.name, sizeof(msg.name), "%s", MP_ACTION_RESPONSE);
+ strlcpy(msg.name, MP_ACTION_RESPONSE, sizeof(msg.name));
if (rte_mp_sendmsg(&msg))
RTE_LOG(ERR, EAL, "Could not send message to secondary process\n");
/* send rollback request */
rb_msg.num_fds = 0;
rb_msg.len_param = sizeof(*rb);
- snprintf(rb_msg.name, sizeof(rb_msg.name), "%s",
- MP_ACTION_ROLLBACK);
+ strlcpy(rb_msg.name, MP_ACTION_ROLLBACK, sizeof(rb_msg.name));
ts.tv_nsec = 0;
ts.tv_sec = MP_TIMEOUT_S;
resp->id = mpreq->id;
msg.num_fds = 0;
msg.len_param = sizeof(*resp);
- snprintf(msg.name, sizeof(msg.name), "%s", MP_ACTION_RESPONSE);
+ strlcpy(msg.name, MP_ACTION_RESPONSE, sizeof(msg.name));
if (rte_mp_sendmsg(&msg))
RTE_LOG(ERR, EAL, "Could not send message to secondary process\n");
msg.num_fds = 0;
msg.len_param = sizeof(*req);
- snprintf(msg.name, sizeof(msg.name), "%s", MP_ACTION_SYNC);
+ strlcpy(msg.name, MP_ACTION_SYNC, sizeof(msg.name));
/* sync request carries no data */
req->t = REQ_TYPE_SYNC;
msg.num_fds = 0;
msg.len_param = sizeof(*msg_req);
- snprintf(msg.name, sizeof(msg.name), "%s", MP_ACTION_REQUEST);
+ strlcpy(msg.name, MP_ACTION_REQUEST, sizeof(msg.name));
/* (attempt to) get a unique id */
user_req->id = get_unique_id();