Do not follow symlink when checking legacy paths

This commit is contained in:
topjohnwu 2018-11-16 01:16:25 -05:00
parent ab74290fe3
commit 77fd5fa7de

View File

@ -507,11 +507,11 @@ static bool prepare_img() {
// Migrate legacy boot scripts // Migrate legacy boot scripts
struct stat st; 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"); cp_afc(LEGACY_CORE "/post-fs-data.d", SECURE_DIR "/post-fs-data.d");
rm_rf(LEGACY_CORE "/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"); cp_afc(LEGACY_CORE "/service.d", SECURE_DIR "/service.d");
rm_rf(LEGACY_CORE "/service.d"); rm_rf(LEGACY_CORE "/service.d");
} }