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-11-14 12:58:34 +0100
commit960415f48ece1cb59135767ccfc44c501530af8f (patch)
tree7c475eb003e6040d3f9e304947ce5dcc3f0503d9
parent05e86722c114bdb04c117ff997b68909c32f8821 (diff)
downloadvold-linaro_android_4.2.1.tar.gz
vold: Handle wrong entries in vold.fstablinaro_android_4.2.1linaro_android_4.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,