summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-09 13:17:13 +0000
committerVolker Lendecke <vl@samba.org>2014-07-24 21:41:10 +0200
commitbe2b89174087b570b61f1dbc321c46debc5f4f50 (patch)
tree323261712e13722a392c8d448b870881443a9c5d /source3/lib/messages.c
parent7f623cbe7913d3a7572e8467d45b03b534f1534a (diff)
downloadsamba-be2b89174087b570b61f1dbc321c46debc5f4f50.tar.gz
samba-be2b89174087b570b61f1dbc321c46debc5f4f50.tar.xz
samba-be2b89174087b570b61f1dbc321c46debc5f4f50.zip
messaging3: Simplify ping_message()
The talloc_strnup was only used to \0-terminate the data for printing. The same can be achieved by %.* in the printf format. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 9d77bf8021..a308a09c90 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -91,17 +91,11 @@ static void ping_message(struct messaging_context *msg_ctx,
DATA_BLOB *data)
{
struct server_id_buf idbuf;
- const char *msg = "none";
- char *free_me = NULL;
- if (data->data != NULL) {
- free_me = talloc_strndup(talloc_tos(), (char *)data->data,
- data->length);
- msg = free_me;
- }
- DEBUG(1, ("INFO: Received PING message from PID %s [%s]\n",
- server_id_str_buf(src, &idbuf), msg));
- TALLOC_FREE(free_me);
+ DEBUG(1, ("INFO: Received PING message from PID %s [%.*s]\n",
+ server_id_str_buf(src, &idbuf), (int)data->length,
+ data->data ? (char *)data->data : ""));
+
messaging_send(msg_ctx, src, MSG_PONG, data);
}