qmodule.c 571 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Copyright (C) 2002 Tim Riker <Tim@Rikers.org>
  3. everyone seems to claim it someplace. ;-)
  4. */
  5. #include <errno.h>
  6. #include "libbb.h"
  7. int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
  8. int my_query_module(const char *name, int which, void **buf,
  9. size_t *bufsize, size_t *ret)
  10. {
  11. int my_ret;
  12. my_ret = query_module(name, which, *buf, *bufsize, ret);
  13. if (my_ret == -1 && errno == ENOSPC) {
  14. *buf = xrealloc(*buf, *ret);
  15. *bufsize = *ret;
  16. my_ret = query_module(name, which, *buf, *bufsize, ret);
  17. }
  18. return my_ret;
  19. }