You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Make sure logs are always ended with newline
This commit is contained in:
@@ -52,7 +52,7 @@ public:
|
||||
switch (type) {
|
||||
case INT:
|
||||
vec.push_back("--ei");
|
||||
snprintf(buf, sizeof(buf), "%d", int_val);
|
||||
ssprintf(buf, sizeof(buf), "%d", int_val);
|
||||
str = buf;
|
||||
val = str.data();
|
||||
break;
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
switch (type) {
|
||||
case INT:
|
||||
str += ":i:";
|
||||
snprintf(buf, sizeof(buf), "%d", int_val);
|
||||
ssprintf(buf, sizeof(buf), "%d", int_val);
|
||||
str += buf;
|
||||
break;
|
||||
case BOOL:
|
||||
@@ -114,13 +114,13 @@ static void exec_cmd(const char *action, vector<Extra> &data,
|
||||
char exe[128];
|
||||
char target[128];
|
||||
char user[4];
|
||||
snprintf(user, sizeof(user), "%d", to_user_id(info->eval_uid));
|
||||
ssprintf(user, sizeof(user), "%d", to_user_id(info->eval_uid));
|
||||
|
||||
if (zygisk_enabled) {
|
||||
#if defined(__LP64__)
|
||||
snprintf(exe, sizeof(exe), "/proc/self/fd/%d", app_process_64);
|
||||
ssprintf(exe, sizeof(exe), "/proc/self/fd/%d", app_process_64);
|
||||
#else
|
||||
snprintf(exe, sizeof(exe), "/proc/self/fd/%d", app_process_32);
|
||||
ssprintf(exe, sizeof(exe), "/proc/self/fd/%d", app_process_32);
|
||||
#endif
|
||||
} else {
|
||||
strlcpy(exe, "/system/bin/app_process", sizeof(exe));
|
||||
@@ -128,7 +128,7 @@ static void exec_cmd(const char *action, vector<Extra> &data,
|
||||
|
||||
// First try content provider call method
|
||||
if (provider) {
|
||||
snprintf(target, sizeof(target), "content://%s.provider", info->mgr_pkg.data());
|
||||
ssprintf(target, sizeof(target), "content://%s.provider", info->mgr_pkg.data());
|
||||
vector<const char *> args{ CALL_PROVIDER };
|
||||
for (auto &e : data) {
|
||||
e.add_bind(args);
|
||||
@@ -165,7 +165,7 @@ static void exec_cmd(const char *action, vector<Extra> &data,
|
||||
|
||||
// Finally, fallback to start activity with component name
|
||||
args[4] = "-n";
|
||||
snprintf(target, sizeof(target), "%s/com.topjohnwu.magisk.ui.surequest.SuRequestActivity", info->mgr_pkg.data());
|
||||
ssprintf(target, sizeof(target), "%s/com.topjohnwu.magisk.ui.surequest.SuRequestActivity", info->mgr_pkg.data());
|
||||
exec.fd = -2;
|
||||
exec.fork = fork_dont_care;
|
||||
exec_command(exec);
|
||||
|
||||
@@ -64,7 +64,7 @@ void su_info::check_db() {
|
||||
|
||||
if (eval_uid > 0) {
|
||||
char query[256], *err;
|
||||
snprintf(query, sizeof(query),
|
||||
ssprintf(query, sizeof(query),
|
||||
"SELECT policy, logging, notification FROM policies "
|
||||
"WHERE uid=%d AND (until=0 OR until>%li)", eval_uid, time(nullptr));
|
||||
err = db_exec(query, [&](db_row &row) -> bool {
|
||||
@@ -125,7 +125,7 @@ bool uid_granted_root(int uid) {
|
||||
bool granted = false;
|
||||
|
||||
char query[256], *err;
|
||||
snprintf(query, sizeof(query),
|
||||
ssprintf(query, sizeof(query),
|
||||
"SELECT policy FROM policies WHERE uid=%d AND (until=0 OR until>%li)",
|
||||
uid, time(nullptr));
|
||||
err = db_exec(query, [&](db_row &row) -> bool {
|
||||
@@ -158,7 +158,7 @@ void prune_su_access() {
|
||||
db_err_cmd(err, return);
|
||||
|
||||
for (int uid : rm_uids) {
|
||||
snprintf(query, sizeof(query), "DELETE FROM policies WHERE uid == %d", uid);
|
||||
ssprintf(query, sizeof(query), "DELETE FROM policies WHERE uid == %d", uid);
|
||||
// Don't care about errors
|
||||
db_exec(query);
|
||||
}
|
||||
@@ -410,11 +410,11 @@ void su_daemon_handler(int client, const sock_cred *cred) {
|
||||
// Setup environment
|
||||
umask(022);
|
||||
char path[32];
|
||||
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
||||
ssprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
||||
char cwd[PATH_MAX];
|
||||
if (realpath(path, cwd))
|
||||
chdir(cwd);
|
||||
snprintf(path, sizeof(path), "/proc/%d/environ", ctx.pid);
|
||||
ssprintf(path, sizeof(path), "/proc/%d/environ", ctx.pid);
|
||||
auto env = full_read(path);
|
||||
clearenv();
|
||||
for (size_t pos = 0; pos < env.size(); ++pos) {
|
||||
|
||||
Reference in New Issue
Block a user