summaryrefslogtreecommitdiff
path: root/dso
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-10-21 03:48:15 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-10-21 03:48:15 +0000
commit7bd23a9ebb3c9f93600c324cafb63f787a7490d7 (patch)
tree49ba9538063d11929d0c5942772a2c4af35f1232 /dso
parent91683aa984c864dda8fb85d1359bd18f5a8bd916 (diff)
downloadlibapr-7bd23a9ebb3c9f93600c324cafb63f787a7490d7.tar.gz
OS/2: Return a proper error code from apr_dso_sym() & prevent NULL dereference
in apr_dso_error() if called after a failure in apr_dso_sym(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62451 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r--dso/os2/dso.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/dso/os2/dso.c b/dso/os2/dso.c
index 2b0a1cde9..b6c53adf5 100644
--- a/dso/os2/dso.c
+++ b/dso/os2/dso.c
@@ -118,8 +118,10 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
if (symname == NULL || ressym == NULL)
return APR_EINIT;
- if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0)
- return APR_EINIT;
+ if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
+ handle->load_error = APR_FROM_OS_ERROR(rc);
+ return handle->load_error;
+ }
*ressym = func;
return APR_SUCCESS;
@@ -131,9 +133,13 @@ APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr
{
char message[200];
apr_strerror(dso->load_error, message, sizeof(message));
- strcat(message, " (");
- strcat(message, dso->failed_module);
- strcat(message, ")");
+
+ if (dso->failed_module != NULL) {
+ strcat(message, " (");
+ strcat(message, dso->failed_module);
+ strcat(message, ")");
+ }
+
apr_cpystrn(buffer, message, buflen);
return buffer;
}