SDR: Adding fru records as part of Get SDR command

Currently Get SDR only responds with physical/virtual sensor
records,it doesn't support for FRU records,This commit adds
the support for FRU records.

Resolves openbmc/openbmc#2776

Change-Id: I34edfa892b32f4e866cf0c084d97c2f3482d40f4
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/ipmid.cpp b/ipmid.cpp
index f06adc5..a05992b 100644
--- a/ipmid.cpp
+++ b/ipmid.cpp
@@ -380,10 +380,11 @@
     if(r != 0)
     {
         fprintf(stderr,"ERROR:[0x%X] handling NetFn:[0x%X], Cmd:[0x%X]\n",r, netfn, cmd);
-
-        if(r < 0) {
-           response[0] = IPMI_CC_UNSPECIFIED_ERROR;
-        }
+        resplen = 0;
+    }
+    else
+    {
+        resplen = resplen - 1; // first byte is for return code.
     }
 
     fprintf(ipmiio, "IPMI Response:\n");
@@ -391,7 +392,7 @@
 
     // Send the response buffer from the ipmi command
     r = send_ipmi_message(m, sequence, netfn, lun, cmd, response[0],
-		    ((unsigned char *)response) + 1, resplen - 1);
+		    ((unsigned char *)response) + 1, resplen);
     if (r < 0) {
         fprintf(stderr, "Failed to send the response message\n");
         return -1;