mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 11:30:47 -05:00
Make sure logs are always ended with newline
This commit is contained in:
@@ -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