diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Makefile.in | 2 | ||||
-rw-r--r-- | libbb/qmodule.c | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index 3f4e773..c97f7d2 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in @@ -38,7 +38,7 @@ LIBBB_SRC:= \ my_getpwnam.c my_getpwnamegid.c my_getpwuid.c obscure.c parse_mode.c \ parse_number.c perror_msg.c perror_msg_and_die.c print_file.c \ process_escape_sequence.c procps.c pwd2spwd.c pw_encrypt.c \ - read_package_field.c recursive_action.c remove_file.c \ + qmodule.c read_package_field.c recursive_action.c remove_file.c \ restricted_shell.c run_parts.c run_shell.c safe_read.c safe_strncpy.c \ setup_environment.c simplify_path.c syscalls.c syslog_msg_with_name.c \ time_string.c trim.c u_signal_names.c vdprintf.c verror_msg.c \ diff --git a/libbb/qmodule.c b/libbb/qmodule.c new file mode 100644 index 0000000..fd14d10 --- /dev/null +++ b/libbb/qmodule.c @@ -0,0 +1,29 @@ +/* + 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; +} + + |