mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-10 04:06:18 -08:00
Make sure logs are always ended with newline
This commit is contained in:
@@ -125,7 +125,7 @@ extern "C" void klog_write(const char *msg, int len) {
|
||||
static int klog_with_rs(LogLevel level, const char *fmt, va_list ap) {
|
||||
char buf[4096];
|
||||
strlcpy(buf, "magiskinit: ", sizeof(buf));
|
||||
int len = vsnprintf(buf + 12, sizeof(buf) - 12, fmt, ap) + 12;
|
||||
int len = vssprintf(buf + 12, sizeof(buf) - 12, fmt, ap) + 12;
|
||||
log_with_rs(level, rust::Str(buf, len));
|
||||
return len;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ void BootConfig::print() {
|
||||
}
|
||||
|
||||
#define read_dt(name, key) \
|
||||
snprintf(file_name, sizeof(file_name), "%s/" name, config->dt_dir); \
|
||||
ssprintf(file_name, sizeof(file_name), "%s/" name, config->dt_dir); \
|
||||
if (access(file_name, R_OK) == 0) { \
|
||||
string data = full_read(file_name); \
|
||||
if (!data.empty()) { \
|
||||
|
||||
@@ -71,7 +71,7 @@ bool MagiskInit::hijack_sepolicy() {
|
||||
// This only happens on Android 8.0 - 9.0
|
||||
|
||||
char buf[4096];
|
||||
snprintf(buf, sizeof(buf), "%s/fstab/compatible", config->dt_dir);
|
||||
ssprintf(buf, sizeof(buf), "%s/fstab/compatible", config->dt_dir);
|
||||
dt_compat = full_read(buf);
|
||||
if (dt_compat.empty()) {
|
||||
// Device does not do early mount and uses monolithic policy
|
||||
@@ -121,7 +121,7 @@ bool MagiskInit::hijack_sepolicy() {
|
||||
int fd = xopen(MOCK_COMPAT, O_WRONLY);
|
||||
|
||||
char buf[4096];
|
||||
snprintf(buf, sizeof(buf), "%s/fstab/compatible", config->dt_dir);
|
||||
ssprintf(buf, sizeof(buf), "%s/fstab/compatible", config->dt_dir);
|
||||
xumount2(buf, MNT_DETACH);
|
||||
|
||||
hijack();
|
||||
|
||||
Reference in New Issue
Block a user