[PATCH] core/bootloader.c: fix build without reallocarray

146 views
Skip to first unread message

Fabrice Fontaine

unread,
May 15, 2022, 8:55:58 AM5/15/22
to swup...@googlegroups.com, Fabrice Fontaine
Use realloc instead of reallocarray to avoid the following build failure
with uclibc raised since version 2022.05 and
https://github.com/sbabic/swupdate/commit/b8897ed695e1cd954859142b14ec8546d2e7994a:

/nvmedata/autobuild/instance-0/output-1/host/lib/gcc/microblaze-buildroot-linux-uclibc/10.3.0/../../../../microblaze-buildroot-linux-uclibc/bin/ld: core/built-in.o: in function `register_bootloader':
(.text.register_bootloader+0x30): undefined reference to `reallocarray'

Fixes:
- http://autobuild.buildroot.org/results/7208e8189b4a6f35aaa4ed7777ecdd37421a7c7f

Signed-off-by: Fabrice Fontaine <fontaine...@gmail.com>
---
core/bootloader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/bootloader.c b/core/bootloader.c
index f34cb41..5694d43 100644
--- a/core/bootloader.c
+++ b/core/bootloader.c
@@ -25,7 +25,7 @@ static unsigned int num_available = 0;

int register_bootloader(const char *name, bootloader *bl)
{
- entry *tmp = reallocarray(available, num_available + 1, sizeof(entry));
+ entry *tmp = realloc(available, (num_available + 1) * sizeof(entry));
if (!tmp) {
return -ENOMEM;
}
--
2.35.1

Reply all
Reply to author
Forward
0 new messages