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