Revert "Merge "BatteryService(jni): properly handle read's return value" into ics-mr0"

This reverts commit f0ad147fc3, reversing
changes made to bd9b152805.
This commit is contained in:
The Android Automerger
2011-11-02 21:04:32 -07:00
parent f17756f8e6
commit b6b117624b

View File

@@ -141,10 +141,10 @@ static int readFromFile(const char* path, char* buf, size_t size)
return -1;
}
ssize_t count = read(fd, buf, size);
size_t count = read(fd, buf, size);
if (count > 0) {
while (count > 0 && buf[count-1] == '\n')
count--;
count = (count < size) ? count : size - 1;
while (count > 0 && buf[count-1] == '\n') count--;
buf[count] = '\0';
} else {
buf[0] = '\0';