From 5da6ea7275cc6bfa2a6155ac7be193001a6be1e5 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Wed, 28 Nov 2012 18:44:22 +0100 Subject: [PATCH] NOP make the message optional Signed-off-by: Peter Lieven --- lib/nop.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/nop.c b/lib/nop.c index 325013a..3f930c0 100644 --- a/lib/nop.c +++ b/lib/nop.c @@ -64,10 +64,12 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb, pdu->callback = cb; pdu->private_data = private_data; - if (iscsi_pdu_add_data(iscsi, pdu, data, len) != 0) { - iscsi_set_error(iscsi, "Failed to add outdata to nop-out"); - iscsi_free_pdu(iscsi, pdu); - return -1; + if (data != NULL && len > 0) { + if (iscsi_pdu_add_data(iscsi, pdu, data, len) != 0) { + iscsi_set_error(iscsi, "Failed to add outdata to nop-out"); + iscsi_free_pdu(iscsi, pdu); + return -1; + } } if (iscsi_queue_pdu(iscsi, pdu) != 0) {