summaryrefslogtreecommitdiff
path: root/host/lib/crossystem.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2016-09-28 11:54:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-10-01 00:04:39 -0700
commit770202f0c745d68f2635dbb8d0f0765aae75a087 (patch)
tree46d29849be392aed1a168e0f291ab98a210dca8d /host/lib/crossystem.c
parentfefc682bb70d7fd997f4ef0079e8fec0a4937cf7 (diff)
downloadvboot-770202f0c745d68f2635dbb8d0f0765aae75a087.tar.gz
Fix more coverity warnings
Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I82ece2de948ef224115c408bdfc09445d3da119b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390337 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'host/lib/crossystem.c')
-rw-r--r--host/lib/crossystem.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 53ec6897..6d70d6aa 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -747,20 +747,24 @@ int VbSetSystemPropertyString(const char* name, const char* value) {
}
-static int InAndroid() {
- int fd;
- struct stat s;
-
- /* In Android, mosys utility located in /system/bin
- check if file exists. Using fstat because for some
- reason, stat() was seg faulting in Android */
- fd = open(MOSYS_ANDROID_PATH, O_RDONLY);
- if (fd != -1 && fstat(fd, &s) == 0) {
- close(fd);
- return 1;
- }
- close(fd);
- return 0;
+static int InAndroid(void)
+{
+ int fd;
+ struct stat s;
+ int retval = 0;
+
+ /*
+ * In Android, mosys utility located in /system/bin check if file
+ * exists. Using fstat because for some reason, stat() was seg
+ * faulting in Android
+ */
+ fd = open(MOSYS_ANDROID_PATH, O_RDONLY);
+ if (fd != -1) {
+ if (fstat(fd, &s) == 0)
+ retval = 1;
+ close(fd);
+ }
+ return retval;
}