mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Use statfs to check rootfs
This helps support adb remount
This commit is contained in:
parent
577b5912af
commit
b249832571
@ -3,6 +3,7 @@
|
|||||||
#include <magisk.hpp>
|
#include <magisk.hpp>
|
||||||
#include <base.hpp>
|
#include <base.hpp>
|
||||||
#include <socket.hpp>
|
#include <socket.hpp>
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
#include "init.hpp"
|
#include "init.hpp"
|
||||||
|
|
||||||
@ -39,11 +40,7 @@ bool SecondStageInit::prepare() {
|
|||||||
argv[0] = (char *) INIT_PATH;
|
argv[0] = (char *) INIT_PATH;
|
||||||
|
|
||||||
// Some weird devices like meizu, uses 2SI but still have legacy rootfs
|
// Some weird devices like meizu, uses 2SI but still have legacy rootfs
|
||||||
// Check if root and system are on different filesystems
|
if (struct statfs sfs{}; statfs("/", &sfs) == 0 && sfs.f_type == RAMFS_MAGIC) {
|
||||||
struct stat root{}, system{};
|
|
||||||
xstat("/", &root);
|
|
||||||
xstat("/system", &system);
|
|
||||||
if (root.st_dev != system.st_dev) {
|
|
||||||
// We are still on rootfs, so make sure we will execute the init of the 2nd stage
|
// We are still on rootfs, so make sure we will execute the init of the 2nd stage
|
||||||
unlink("/init");
|
unlink("/init");
|
||||||
xsymlink(INIT_PATH, "/init");
|
xsymlink(INIT_PATH, "/init");
|
||||||
|
Loading…
Reference in New Issue
Block a user