summaryrefslogtreecommitdiffhomepage
path: root/libbb/qmodule.c
blob: 4e4e79d38aa790bfa761642e2d5093ecb288087a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* vi: set sw=4 ts=4: */
/*
   Copyright (C) 2002 Tim Riker <Tim@Rikers.org>
   everyone seems to claim it someplace. ;-)
*/

#include <errno.h>

#include "libbb.h"

int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);

int my_query_module(const char *name, int which, void **buf,
		size_t *bufsize, size_t *ret)
{
	int my_ret;

	my_ret = query_module(name, which, *buf, *bufsize, ret);

	if (my_ret == -1 && errno == ENOSPC) {
		*buf = xrealloc(*buf, *ret);
		*bufsize = *ret;

		my_ret = query_module(name, which, *buf, *bufsize, ret);
	}

	return my_ret;
}