summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2012-09-10 10:22:00 +0000
committerBernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>2012-10-10 14:52:38 +0200
commitdc0cbc485a9902292266dcdde1f9b8794dd19789 (patch)
tree05b7a0cc458753199321b26007323b605759dcf0
parent425430bc2e58496d79fa4bd7e0d6e29f19e7a965 (diff)
downloadvold-linaro_android_4.1.2.tar.gz
vold: Handle wrong entries in vold.fstablinaro_android_4.1.2
If the entry in vold.fstab doesn't exist then vold is crashing in realpath where it tries to resolve symlink. Due to the crash in vold the system keeps restarting vold and never completes the boot process. This fixes the bugs: https://bugs.launchpad.net/linaro-android/+bug/1048476 https://bugs.launchpad.net/linaro-android/+bug/1047964 Change-Id: I49a2da8c8813afcbf0dbaede6bc19dc987db61a6 Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rw-r--r--main.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index f47681ce..04746aa4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -224,8 +224,14 @@ static int process_config(VolumeManager *vm) {
*/
char sp[sizeof(line)] = "/sys";
strcat(sp, sysfs_path);
+ struct stat s;
+ int error = stat(sp, &s);
+ if (error == -1) {
+ SLOGE("wrong entry in vold.fstab %s", sysfs_path);
+ goto out_fail;
+ }
char *rp = realpath(sp, NULL);
- int error = dv->addPath(rp + 4); /* Real path without '/sys' */
+ error = dv->addPath(rp + 4); /* Real path without '/sys' */
free(rp);
if (error) {
SLOGE("Failed to add devpath %s to volume %s", sysfs_path,