diff options
-rw-r--r-- | services/jni/com_android_server_BatteryService.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index b9f2c1f..2ceb535 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp @@ -141,10 +141,10 @@ static int readFromFile(const char* path, char* buf, size_t size) return -1; } - size_t count = read(fd, buf, size); + ssize_t count = read(fd, buf, size); if (count > 0) { - count = (count < size) ? count : size - 1; - while (count > 0 && buf[count-1] == '\n') count--; + while (count > 0 && buf[count-1] == '\n') + count--; buf[count] = '\0'; } else { buf[0] = '\0'; |