Fix return value for the pldm_send method

- If the caller uses invalid mctp_eid to call the pldm_send/sendmsg
  method, it will return a value greater than 0(non -1).

- At this time, the pldm_send method will return to
  `PLDM_REQUESTER_SUCCESS`, and will cause the pldm daemon to die.

Tested:
- use an invalid mctp_eid:
  Before:
  pldmtool platform getpdr -d 0 -m 11 -v
  the pldm daemon to die.

  After:
  pldmtool platform getpdr -d 0 -m 11 -v
  Request Message:
  0b 01 80 02 51 00 00 00 00 00 00 00 00 01 ff ff 00 00
  Failed to call pldm_send_recv, rc = 18
  pldmSendRecv: Failed to receive RC = 18

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I12eb5a83e7848a5aaec3e7f38b142a9e64d3dd45
diff --git a/libpldm/requester/pldm.c b/libpldm/requester/pldm.c
index 932f55e..5b8fdf4 100644
--- a/libpldm/requester/pldm.c
+++ b/libpldm/requester/pldm.c
@@ -180,9 +180,5 @@
 	msg.msg_iov = iov;
 	msg.msg_iovlen = sizeof(iov) / sizeof(iov[0]);
 
-	ssize_t rc = sendmsg(mctp_fd, &msg, 0);
-	if (rc == -1) {
-		return PLDM_REQUESTER_SEND_FAIL;
-	}
-	return PLDM_REQUESTER_SUCCESS;
+	return sendmsg(mctp_fd, &msg, 0);
 }
diff --git a/pldmtool/pldm_cmd_helper.cpp b/pldmtool/pldm_cmd_helper.cpp
index 10e051f..2173287 100644
--- a/pldmtool/pldm_cmd_helper.cpp
+++ b/pldmtool/pldm_cmd_helper.cpp
@@ -205,9 +205,15 @@
         }
         uint8_t* responseMessage = nullptr;
         size_t responseMessageSize{};
-        pldm_send_recv(mctp_eid, fd, requestMsg.data() + 2,
-                       requestMsg.size() - 2, &responseMessage,
-                       &responseMessageSize);
+        auto rc = pldm_send_recv(mctp_eid, fd, requestMsg.data() + 2,
+                                 requestMsg.size() - 2, &responseMessage,
+                                 &responseMessageSize);
+        if (rc != PLDM_REQUESTER_SUCCESS)
+        {
+            std::cerr << "Failed to call pldm_send_recv, rc = " << rc
+                      << std::endl;
+            return rc;
+        }
 
         Logger(pldmVerbose, "Response Message:", "");
         responseMsg.resize(responseMessageSize);
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index d215c1d..14bc670 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -411,7 +411,7 @@
 
     // Send PLDM Request message - pldm_send doesn't wait for response
     rc = pldm_send(mctpEID, fd, requestMsg.data(), requestMsg.size());
-    if (0 > rc)
+    if (rc != PLDM_REQUESTER_SUCCESS)
     {
         std::cerr << "Failed to send message/receive response. RC = " << rc
                   << ", errno = " << errno << "\n";
diff --git a/utilities/requester/set_state_effecter_async.cpp b/utilities/requester/set_state_effecter_async.cpp
index 303aefe..0750c7d 100644
--- a/utilities/requester/set_state_effecter_async.cpp
+++ b/utilities/requester/set_state_effecter_async.cpp
@@ -78,7 +78,7 @@
 
     // Send PLDM Request message - pldm_send doesn't wait for response
     rc = pldm_send(mctpEid, fd, requestMsg.data(), requestMsg.size());
-    if (0 > rc)
+    if (rc != PLDM_REQUESTER_SUCCESS)
     {
         std::cerr << "Failed to send message/receive response. RC = " << rc
                   << ", errno = " << errno << "\n";