Use apr_psprintf() instead of apr_strerror() to avoid a worst case allocation.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890980 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dbm/apr_dbm.c b/dbm/apr_dbm.c
index 5d938e6..904543b 100644
--- a/dbm/apr_dbm.c
+++ b/dbm/apr_dbm.c
@@ -87,7 +87,7 @@
}
if (!type) {
- type = DBM_NAME;
+ type = DBM_NAME;
}
*vtable = NULL;
@@ -112,11 +112,10 @@
}
if (result && !*result) {
- char *buffer = apr_pcalloc(pool, ERROR_SIZE);
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;
+ if (err) {
+ apr_status_t rv = APR_ENOTIMPL;
+ err->msg = apr_psprintf(pool, "%pm", &rv);
err->reason = apr_pstrdup(pool, type);
*result = err;
}
@@ -138,7 +137,7 @@
}
if (!type) {
- type = DBM_NAME;
+ type = DBM_NAME;
}
if (!strcasecmp(type, "default")) type = DBM_NAME;