You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Yann Ylavic <yl...@gmail.com> on 2021/06/22 14:39:07 UTC
Re: svn commit: r1890952 - in /apr/apr/trunk: CHANGES dbm/apr_dbm.c
dbm/apr_dbm_berkeleydb.c dbm/apr_dbm_gdbm.c dbm/apr_dbm_ndbm.c
dbm/apr_dbm_sdbm.c include/apr_dbm.h include/private/apr_dbm_private.h
On Mon, Jun 21, 2021 at 11:26 PM <mi...@apache.org> wrote:
>
> Author: minfrin
> Date: Mon Jun 21 21:26:54 2021
> New Revision: 1890952
[]
>
> +APR_DECLARE(apr_status_t) apr_dbm_get_driver(const apr_dbm_driver_t **vtable,
> + const char *type, const apu_err_t **result, apr_pool_t *pool)
> {
[]
> +
> + if (result && !*result) {
> + char *buffer = apr_pcalloc(pool, ERROR_SIZE);
Maybe use :
apr_status_t rv = APR_ENOTIMPL;
char *buffer = apr_psprintf(pool, "%pm", &rv);
to avoid arbitrary ERROR_SIZE allocation?
> + apu_err_t *err = apr_pcalloc(pool, sizeof(apu_err_t));
> + if (err && buffer) {
> + apr_strerror(APR_ENOTIMPL, buffer, ERROR_SIZE - 1);
> + err->msg = buffer;
> + err->reason = apr_pstrdup(pool, type);
> + *result = err;
> + }
> + }
> +
> return APR_ENOTIMPL;
>
> #else /* APR_HAVE_MODULAR_DSO */
>
[]
> +
> + if (APR_SUCCESS != rv && result && !*result) {
> + char *buffer = apr_pcalloc(pool, ERROR_SIZE);
Same here.
> + apu_err_t *err = apr_pcalloc(pool, sizeof(apu_err_t));
> + if (err && buffer) {
> + apr_dso_error(dso, buffer, ERROR_SIZE - 1);
> + err->msg = buffer;
> + err->reason = apr_pstrdup(pool, modname);
> + *result = err;
> + }
> + }
> +
> return rv;
Regards;
Yann.