From 3ae959af95fbf3620da67d26ee483f716ccb63b4 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 19 Jul 2018 17:43:37 +0800 Subject: [PATCH] Do not early mount on symlinks on half Treble devices Fix #399 --- native/jni/core/magiskinit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native/jni/core/magiskinit.c b/native/jni/core/magiskinit.c index 3a91522cc..820dab8c8 100644 --- a/native/jni/core/magiskinit.c +++ b/native/jni/core/magiskinit.c @@ -157,6 +157,12 @@ static int strend(const char *s1, const char *s2) { static int read_fstab_dt(const struct cmdline *cmd, const char *mnt_point, char *partname) { char buf[128]; + struct stat st; + sprintf(buf, "/%s", mnt_point); + lstat(buf, &st); + // Don't early mount if the mount point is symlink + if (S_ISLNK(st.st_mode)) + return 1; sprintf(buf, "%s/fstab/%s/dev", cmd->dt_dir, mnt_point); if (access(buf, F_OK) == 0) { int fd = open(buf, O_RDONLY | O_CLOEXEC);