diff options
Diffstat (limited to 'extendedcommands.c')
-rw-r--r-- | extendedcommands.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/extendedcommands.c b/extendedcommands.c index eda092c..5a1ab6d 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -1570,7 +1570,9 @@ int verify_root_and_recovery() { } } + int exists = 0; if (0 == lstat("/system/bin/su", &st)) { + exists = 1; if (S_ISREG(st.st_mode)) { if ((st.st_mode & (S_ISUID | S_ISGID)) != (S_ISUID | S_ISGID)) { ui_show_text(1); @@ -1583,6 +1585,7 @@ int verify_root_and_recovery() { } if (0 == lstat("/system/xbin/su", &st)) { + exists = 1; if (S_ISREG(st.st_mode)) { if ((st.st_mode & (S_ISUID | S_ISGID)) != (S_ISUID | S_ISGID)) { ui_show_text(1); @@ -1594,6 +1597,16 @@ int verify_root_and_recovery() { } } + if (!exists) { + ui_show_text(1); + ret = 1; + if (confirm_selection("Root access is missing. Root device?", "Yes - Root device (/system/xbin/su)")) { + __system("cp /sbin/su /system/xbin/su"); + __system("chmod 6755 /system/xbin/su"); + __system("ln -sf /system/xbin/su /system/bin/su"); + } + } + ensure_path_unmounted("/system"); return ret; } |