Skip to content

Commit 5378210

Browse files
unkn0wNameunkn0wName
authored andcommitted
fix: 升级C++17
1 parent 6f3e038 commit 5378210

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

testRoot/jni/Android.mk

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
LOCAL_PATH := $(call my-dir)
22

33
include $(CLEAR_VARS)
4-
LOCAL_CPPFLAGS += -std=c++1y
5-
LOCAL_CFLAGS += -fPIE
6-
LOCAL_CFLAGS += -fvisibility=hidden
4+
LOCAL_CPPFLAGS += -std=c++17 -fPIE -frtti -fvisibility=hidden
75
LOCAL_LDFLAGS += -fPIE -pie
86
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
9-
LOCAL_MODULE := testRoot.out
10-
LOCAL_SRC_FILES := ../testRoot.cpp ../base64.cpp ../process64_inject.cpp ../ptrace_arm64_utils.cpp ../su_install_helper.cpp
7+
LOCAL_MODULE := testRoot.out
8+
LOCAL_SRC_FILES := \
9+
../testRoot.cpp \
10+
../base64.cpp \
11+
../process64_inject.cpp \
12+
../ptrace_arm64_utils.cpp \
13+
../su_install_helper.cpp
14+
1115
include $(BUILD_EXECUTABLE)

testRoot/su_install_helper.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <iostream>
1010
#include <fstream>
1111
#include <memory>
12+
#include <filesystem>
1213
#include <sys/stat.h>
1314
#include <sys/types.h>
1415
#include <sys/xattr.h>
@@ -157,13 +158,9 @@ ssize_t uninstall_su(const char* str_root_key, const char* base_path, const char
157158
remove(std::string(_su_hide_path + std::string("/su")).c_str());
158159

159160
//文件夹也删掉
160-
std::string del_dir_cmd = "rm -rf ";
161-
del_dir_cmd += _su_hide_path;
162-
ssize_t err;
163-
kernel_root::run_root_cmd(str_root_key, del_dir_cmd.c_str(), err);
164-
if (err) {
165-
return err;
166-
}
161+
try {
162+
std::filesystem::remove_all(_su_hide_path);
163+
} catch (...) {}
167164
return access(_su_hide_path.c_str(), F_OK) == -1 ? 0 : -512;
168165

169166
} while (1);

0 commit comments

Comments
 (0)