GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: 修复无法注入su到第二个进程 · code699/SKRoot-linuxKernelRoot@adcb704

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • PermissionManager/app/src/main/cpp
    • root.cpp
  • testRoot
    • su_install_helper.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎PermissionManager/app/src/main/cpp/root.cpp‎

Copy file name to clipboardExpand all lines: PermissionManager/app/src/main/cpp/root.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Java_com_linux_permissionmanager_MainActivity_autoSuEnvInject(
236236
}
237237
std::string kill_cmd;
238238
for (pid_t t : vOut) {
239-
err = kill_process(strRootKey.c_str(), t);
239+
err = safe_kill_process(strRootKey.c_str(), t);
240240
sstr << "kill_ret err:"<< err << std::endl;
241241
if (err != 0) {
242242
return env->NewStringUTF(sstr.str().c_str());
Collapse file

‎testRoot/su_install_helper.cpp‎

Copy file name to clipboardExpand all lines: testRoot/su_install_helper.cpp
+12-9Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ std::string install_su(const char* str_root_key, const char* base_path, const ch
9191
return {};
9292
}
9393
std::string su_hide_full_path = _su_hide_folder_path + "/" + "su";
94-
if (!copy_file(origin_su_full_path, su_hide_full_path.c_str())) {
95-
TRACE("copy file error.\n");
96-
err = -504;
97-
return {};
98-
}
99-
if (!set_file_allow_access_mode(su_hide_full_path.c_str())) {
100-
TRACE("set file allow access mode error.\n");
101-
err = -505;
102-
return {};
94+
//如果存在了就不要理了
95+
if(access(su_hide_full_path.c_str(), F_OK) == -1) {
96+
if (!copy_file(origin_su_full_path, su_hide_full_path.c_str())) {
97+
TRACE("copy file error.\n");
98+
err = -504;
99+
return {};
100+
}
101+
if (!set_file_allow_access_mode(su_hide_full_path.c_str())) {
102+
TRACE("set file allow access mode error.\n");
103+
err = -505;
104+
return {};
105+
}
103106
}
104107
err = 0;
105108
return su_hide_full_path;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.