diff --git a/writefrudata.C b/writefrudata.C
index 153ac93..69bbb47 100644
--- a/writefrudata.C
+++ b/writefrudata.C
@@ -483,15 +483,11 @@
     uint8_t offset = 0;
     uint16_t len = 0;
     ipmi_ret_t rc = IPMI_CC_INVALID;
-    int validate_rc = 0;
     const char *mode = NULL;
 
     // From the payload, extract the header that has fruid and the offsets
     write_fru_data_t *reqptr = (write_fru_data_t*)request;
 
-    // There is no response data for this command.
-    *data_len = 0;
-
     // Maintaining a temporary file to pump the data
     sprintf(fru_file_name, "%s%02x", "/tmp/ipmifru", reqptr->frunum);
 
@@ -502,25 +498,23 @@
     // the data (so didn't need to worry about word/byte boundaries)
     // hence the -1...
     len = ((uint16_t)*data_len) - (sizeof(write_fru_data_t)-1);
+
+    // On error there is no response data for this command.
+    *data_len = 0;
     
 #ifdef __IPMI__DEBUG__
     printf("IPMI WRITE-FRU-DATA for [%s]  Offset = [%d] Length = [%d]\n",
             fru_file_name, offset, len);
 #endif
 
-    // offset would be zero if the cmd payload is targeting a new fru
-    if (offset == 0)
-    {
+
+    if( access( fru_file_name, F_OK ) == -1 ) {
         mode = "wb";
-    } 
-    else 
-    {
-        // offset would be non-zero if the cmd payload is continued for prev
-        // fru
+    } else {
         mode = "rb+";
     }
 
-    if ((fp = fopen(fru_file_name, mode)) != NULL) 
+    if ((fp = fopen(fru_file_name, mode)) != NULL)
     {
         if(fseek(fp, offset, SEEK_SET))
         {
@@ -543,18 +537,17 @@
         fprintf(stderr, "Error trying to write to fru file %s\n",fru_file_name);
         return rc;
     }
-    
-    // We received some bytes. It may be full or partial. Run a validator.
-    validate_rc = ipmi_validate_fru_area(reqptr->frunum, fru_file_name);
-    if(validate_rc != -1)
-    {
-        // Success validating _and_ updating the Inventory. We no longer need
-        // this file.
-        remove(fru_file_name);
-    }
 
-    // convert the rc per ipmi spec   
-    rc = (validate_rc != -1) ? IPMI_CC_OK : IPMI_CC_INVALID;
+
+    // If we got here then set the resonse byte
+    // to the number of bytes written
+    memcpy(response, &len, 1);
+    *data_len = 1;
+    rc = IPMI_CC_OK;
+
+    // We received some bytes. It may be full or partial. Send a valid
+    // FRU file to the inventory controller on DBus for the correct number
+    ipmi_validate_fru_area(reqptr->frunum, fru_file_name);
 
     return rc;
 }
