Remove usage of MAGISKTMP

This commit is contained in:
topjohnwu
2023-11-02 15:50:36 -07:00
parent 3ba00858e6
commit 16ae4aedf1
12 changed files with 72 additions and 72 deletions

View File

@@ -5,6 +5,7 @@
#include <magisk.hpp>
#include <base.hpp>
#include <selinux.hpp>
#include <daemon.hpp>
#include <flags.h>
using namespace std;
@@ -121,17 +122,18 @@ void restorecon() {
}
void restore_tmpcon() {
if (MAGISKTMP == "/sbin")
setfilecon(MAGISKTMP.data(), ROOT_CON);
const char *tmp = get_magisk_tmp();
if (tmp == "/sbin"sv)
setfilecon(tmp, ROOT_CON);
else
chmod(MAGISKTMP.data(), 0711);
chmod(tmp, 0711);
auto dir = xopen_dir(MAGISKTMP.data());
auto dir = xopen_dir(tmp);
int dfd = dirfd(dir.get());
for (dirent *entry; (entry = xreaddir(dir.get()));)
setfilecon_at(dfd, entry->d_name, SYSTEM_CON);
string logd = MAGISKTMP + "/" LOG_PIPE;
string logd = tmp + "/"s LOG_PIPE;
setfilecon(logd.data(), MAGISK_FILE_CON);
}