summaryrefslogtreecommitdiff
path: root/dso/os2
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2000-05-31 02:30:27 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2000-05-31 02:30:27 +0000
commit995a6ed99276bb968b1600ad6b569e56ca8311cd (patch)
tree5ddf9d6d6878001e019443ef882e0fd562a98870 /dso/os2
parent841efd649fe20edc5ad993fd4a34e9101e912f3a (diff)
downloadlibapr-995a6ed99276bb968b1600ad6b569e56ca8311cd.tar.gz
Rework DSO error reporting to be more flexible & informative.
This patch covers os/2, unix & win32. Other platforms still need some adjustment (BeOS, AIX). Reviewed by: rbb, gstein git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/os2')
-rw-r--r--dso/os2/dso.c19
-rw-r--r--dso/os2/dso.h1
2 files changed, 14 insertions, 6 deletions
diff --git a/dso/os2/dso.c b/dso/os2/dso.c
index e9129fe13..4f4f71d62 100644
--- a/dso/os2/dso.c
+++ b/dso/os2/dso.c
@@ -73,20 +73,22 @@ static ap_status_t dso_cleanup(void *thedso)
ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, ap_pool_t *ctx)
{
- char failed_module[1024];
+ char failed_module[20];
HMODULE handle;
int rc;
*res_handle = ap_pcalloc(ctx, sizeof(*res_handle));
+ (*res_handle)->cont = ctx;
+ (*res_handle)->load_error = APR_SUCCESS;
+ (*res_handle)->failed_module = NULL;
if ((rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle)) != 0) {
+ (*res_handle)->load_error = APR_OS2_STATUS(rc);
(*res_handle)->failed_module = ap_pstrdup(ctx, failed_module);
return APR_OS2_STATUS(rc);
}
(*res_handle)->handle = handle;
- (*res_handle)->cont = ctx;
- (*res_handle)->failed_module = NULL;
ap_register_cleanup(ctx, *res_handle, dso_cleanup, ap_null_cleanup);
return APR_SUCCESS;
}
@@ -129,8 +131,13 @@ ap_status_t ap_dso_sym(ap_dso_handle_sym_t *ressym,
-/* Just a stub, it will never be called because we never return APR_EDSOOPEN */
-char *ap_dso_error(char *buf, int bufsize, ap_status_t errcode)
+char *ap_dso_error(ap_dso_handle_t *dso, char *buffer, ap_size_t buflen)
{
- return NULL;
+ char message[200];
+ ap_strerror(dso->load_error, message, sizeof(message));
+ strcat(message, " (");
+ strcat(message, dso->failed_module);
+ strcat(message, ")");
+ ap_cpystrn(buffer, message, buflen);
+ return buffer;
}
diff --git a/dso/os2/dso.h b/dso/os2/dso.h
index 02855bb0c..86d82f22a 100644
--- a/dso/os2/dso.h
+++ b/dso/os2/dso.h
@@ -66,6 +66,7 @@
struct ap_dso_handle_t {
ap_pool_t *cont; /* Context for returning error strings */
HMODULE handle; /* Handle to the DSO loaded */
+ ap_status_t load_error;
char *failed_module;
};