]> git.ipfire.org Git - thirdparty/grub.git/commit
loader/linux: Only emit newc directory once
authorGlenn Washburn <development@efficientek.com>
Wed, 28 Jun 2023 07:25:16 +0000 (02:25 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 3 Jul 2023 11:36:10 +0000 (13:36 +0200)
commit16b09cd056a271e7a09a3406411561393a95761a
tree20ecd206754aef7f48e2807be9a63e61459668b5
parent931a912b433e00004ddbe201e3678cb91c11b332
loader/linux: Only emit newc directory once

When creating at runtime a newc initrd via arguments to initrd with "newc:"
prefixes, only emit a directory path record once. The original code
intended to do that by bailing out of emitting the record when the record
to be created matches an existing record. However, this does not happen
because grub_memcmp() is improperly checked.

Generating duplicate newc directory records does not cause any problems
because the Linux unpacker will skip it once it sees the directory already
exists. This fix saves a little processing and makes the generated newc
cpio archive a little smaller.

Fixes: 92750e4c60 (Add ability to generate newc additions on runtime.)
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/linux.c