rk3399 禁止用户更改system读写权限(mount -orw,remount /system)

--- a/external/toybox/toys/lsb/mount.c
+++ b/external/toybox/toys/lsb/mount.c
@@ -45,6 +45,8 @@ config MOUNT
 
 #define FOR_mount
 #include "toys.h"
+#include <stdio.h>
+#include <sys/system_properties.h>
 
 GLOBALS(
   struct arg_list *optlist;
@@ -266,6 +268,8 @@ void mount_main(void)
   struct arg_list *o;
   struct mtab_list *mtl, *mtl2 = 0, *mm, *remount;
 
 // TODO
 // remount
 //   - overmounts
@@ -305,6 +309,19 @@ void mount_main(void)
   // Do we need to do an /etc/fstab trawl?
   // This covers -a, -o remount, one argument, all user mounts
   if ((toys.optflags & FLAG_a) || (dev && (!dir || getuid() || remount))) {
+
+    char bootCompleted[10];
+
+    __system_property_get("sys.boot_completed",bootCompleted);
+
+    if (strcmp(bootCompleted, "1") == 0) {
+       if (strcmp(dev,"/system") == 0) {
+           return;
+       } else if (strcmp(dev,"/vcsystem") == 0) {
+           strcpy(dev,"/system");
+       }
+    }
+
     if (!remount) dlist_terminate(mtl = xgetmountlist("/etc/fstab"));
 
     for (mm = remount ? remount : mtl; mm; mm = (remount ? mm->prev : mm->next))

猜你喜欢

转载自blog.csdn.net/u014630142/article/details/108737712
今日推荐