Tim Riker | cf93274 | 2002-12-14 01:58:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2002 Tim Riker <Tim@Rikers.org> |
| 3 | everyone seems to claim it someplace. ;-) |
| 4 | */ |
| 5 | |
| 6 | #include <errno.h> |
| 7 | |
| 8 | #include "libbb.h" |
| 9 | |
| 10 | int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret); |
| 11 | |
| 12 | int my_query_module(const char *name, int which, void **buf, |
| 13 | size_t *bufsize, size_t *ret) |
| 14 | { |
| 15 | int my_ret; |
| 16 | |
| 17 | my_ret = query_module(name, which, *buf, *bufsize, ret); |
| 18 | |
| 19 | if (my_ret == -1 && errno == ENOSPC) { |
| 20 | *buf = xrealloc(*buf, *ret); |
| 21 | *bufsize = *ret; |
| 22 | |
| 23 | my_ret = query_module(name, which, *buf, *bufsize, ret); |
| 24 | } |
| 25 | |
| 26 | return my_ret; |
| 27 | } |
| 28 | |
| 29 | |