From f67d6bd3c0fb41d167c675b9d2b5d377b6f38a74 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Thu, 26 Jun 2014 14:55:04 -0700 Subject: [PATCH] Moved symlink back up. Moving the vendor symlink down was causing issues with some devices. Moved it back up, and adjusted mount to remove symlinks if necessary. Change-Id: I77126d77cfbef32250012bea3960c99b55db4cbb Signed-off-by: Daniel Rosenberg --- fs_mgr/fs_mgr.c | 9 ++++++++- rootdir/init.rc | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c index 4fad6ad5e..ab3c5a66d 100644 --- a/fs_mgr/fs_mgr.c +++ b/fs_mgr/fs_mgr.c @@ -197,7 +197,14 @@ static int __mount(const char *source, const char *target, const struct fstab_re unsigned long mountflags = rec->flags; int ret; int save_errno; - + + /* We need this because sometimes we have legacy symlinks + * that are lingering around and need cleaning up. + */ + struct stat info; + if (!lstat(target, &info)) + if ((info.st_mode & S_IFMT) == S_IFLNK) + unlink(target); mkdir(target, 0755); ret = mount(source, target, rec->fs_type, mountflags, rec->fs_options); save_errno = errno; diff --git a/rootdir/init.rc b/rootdir/init.rc index 45928bb24..7d2addb4c 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -38,6 +38,10 @@ on init symlink /system/etc /etc symlink /sys/kernel/debug /d + # Right now vendor lives on the same filesystem as system, + # but someday that may change. + symlink /system/vendor /vendor + # Create cgroup mount point for cpu accounting mkdir /acct mount cgroup none /acct cpuacct @@ -180,10 +184,6 @@ on late-init trigger boot on post-fs - # Right now vendor lives on the same filesystem as system, - # but someday that may change. If it has, this symlink will fail. - symlink /system/vendor /vendor - # once everything is setup, no need to modify / mount rootfs rootfs / ro remount # mount shared so changes propagate into child namespaces