idmapped-mounts: Fix build error because of undefined reallocarray
[xfstests-dev.git] / src / idmapped-mounts / idmapped-mounts.c
index 4230cb48c7bf6b081376bee8db13eff258c2ac2e..83b7c89ab01571ae8609c5605539d0992ab996e6 100644 (file)
@@ -9910,8 +9910,12 @@ static int append_stack(struct btrfs_iter *iter, uint64_t tree_id, size_t path_l
        if (iter->stack_len >= iter->stack_capacity) {
                size_t new_capacity = iter->stack_capacity * 2;
                struct btrfs_stack *new_search_stack;
+#ifdef HAVE_REALLOCARRAY
                new_search_stack = reallocarray(iter->search_stack, new_capacity,
                                                sizeof(*iter->search_stack));
+#else
+               new_search_stack = realloc(iter->search_stack, new_capacity * sizeof(*iter->search_stack));
+#endif
                if (!new_search_stack)
                        return -ENOMEM;