Fastbootd: General fixes and changes

read data once bug fix
ability to run fastbootd without network and named socket configuration in init.rc
vendortrigger name changed to fastbootd
deleted unused function from default implementation of OEM library

Change-Id: Ib957fae8172530f20d51bb51b5e07bccab07e555
diff --git a/fastbootd/commands/flash.h b/fastbootd/commands/flash.h
index 86dc811..5a64cab 100644
--- a/fastbootd/commands/flash.h
+++ b/fastbootd/commands/flash.h
@@ -32,6 +32,11 @@
 #ifndef _FASTBOOTD_ERASE_H
 #define _FASTBOOTD_ERASE_H
 
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "debug.h"
+
 int flash_find_entry(const char *, char *, size_t);
 int flash_erase(int fd);
 
@@ -50,10 +55,12 @@
     ssize_t len;
 
     while ((len = TEMP_FAILURE_RETRY(read(fd, (void *) &buffer[readcount], size - readcount))) > 0) {
-        readcount -= len;
+        readcount += len;
     }
-    if (len < 0)
+    if (len < 0) {
+        D(ERR, "Read error:%s", strerror(errno));
         return len;
+    }
 
     return readcount;
 }