From 77fd5fa7dee19906ebc440646b8641ad237e146d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 16 Nov 2018 01:16:25 -0500 Subject: [PATCH] Do not follow symlink when checking legacy paths --- native/jni/daemon/bootstages.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/jni/daemon/bootstages.cpp b/native/jni/daemon/bootstages.cpp index aca133ccd..f31f1a7dc 100644 --- a/native/jni/daemon/bootstages.cpp +++ b/native/jni/daemon/bootstages.cpp @@ -507,11 +507,11 @@ static bool prepare_img() { // Migrate legacy boot scripts struct stat st; - if (stat(LEGACY_CORE "/post-fs-data.d", &st) == 0 && S_ISDIR(st.st_mode)) { + if (lstat(LEGACY_CORE "/post-fs-data.d", &st) == 0 && S_ISDIR(st.st_mode)) { cp_afc(LEGACY_CORE "/post-fs-data.d", SECURE_DIR "/post-fs-data.d"); rm_rf(LEGACY_CORE "/post-fs-data.d"); } - if (stat(LEGACY_CORE "/service.d", &st) == 0 && S_ISDIR(st.st_mode)) { + if (lstat(LEGACY_CORE "/service.d", &st) == 0 && S_ISDIR(st.st_mode)) { cp_afc(LEGACY_CORE "/service.d", SECURE_DIR "/service.d"); rm_rf(LEGACY_CORE "/service.d"); }