mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-23 00:17:42 +00:00
Header v3 does not have name entry
This commit is contained in:
parent
1385d2a4f4
commit
552ec1eb35
@ -104,6 +104,7 @@ void dyn_img_hdr::print() {
|
|||||||
void dyn_img_hdr::dump_hdr_file() {
|
void dyn_img_hdr::dump_hdr_file() {
|
||||||
FILE *fp = xfopen(HEADER_FILE, "w");
|
FILE *fp = xfopen(HEADER_FILE, "w");
|
||||||
fprintf(fp, "pagesize=%u\n", page_size());
|
fprintf(fp, "pagesize=%u\n", page_size());
|
||||||
|
if (name())
|
||||||
fprintf(fp, "name=%s\n", name());
|
fprintf(fp, "name=%s\n", name());
|
||||||
fprintf(fp, "cmdline=%.*s%.*s\n", BOOT_ARGS_SIZE, cmdline(), BOOT_EXTRA_ARGS_SIZE, extra_cmdline());
|
fprintf(fp, "cmdline=%.*s%.*s\n", BOOT_ARGS_SIZE, cmdline(), BOOT_EXTRA_ARGS_SIZE, extra_cmdline());
|
||||||
uint32_t ver = os_version();
|
uint32_t ver = os_version();
|
||||||
@ -129,7 +130,7 @@ void dyn_img_hdr::load_hdr_file() {
|
|||||||
parse_prop_file(HEADER_FILE, [=](string_view key, string_view value) -> bool {
|
parse_prop_file(HEADER_FILE, [=](string_view key, string_view value) -> bool {
|
||||||
if (key == "page_size") {
|
if (key == "page_size") {
|
||||||
page_size() = parse_int(value);
|
page_size() = parse_int(value);
|
||||||
} else if (key == "name") {
|
} else if (key == "name" && name()) {
|
||||||
memset(name(), 0, 16);
|
memset(name(), 0, 16);
|
||||||
memcpy(name(), value.data(), value.length() > 15 ? 15 : value.length());
|
memcpy(name(), value.data(), value.length() > 15 ? 15 : value.length());
|
||||||
} else if (key == "cmdline") {
|
} else if (key == "cmdline") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user