summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-11-01 22:32:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-01 22:32:06 +0000
commita9656df58f75946f3eab4dd660df56c9d878a04e (patch)
tree8aea9d4770c08c5a69e970dd9ada848a95f4be9a /services
parenta0d5bece38f3b8fb430f3fb996e7baefb78d8602 (diff)
parentf0ad147fc33cf55cd9427010b2cdb3eb89b9eec3 (diff)
downloadframeworks_base-a9656df58f75946f3eab4dd660df56c9d878a04e.zip
frameworks_base-a9656df58f75946f3eab4dd660df56c9d878a04e.tar.gz
frameworks_base-a9656df58f75946f3eab4dd660df56c9d878a04e.tar.bz2
am f0ad147f: Merge "BatteryService(jni): properly handle read\'s return value" into ics-mr0
* commit 'f0ad147fc33cf55cd9427010b2cdb3eb89b9eec3': BatteryService(jni): properly handle read's return value
Diffstat (limited to 'services')
-rw-r--r--services/jni/com_android_server_BatteryService.cpp6
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';