X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=os2%2Fdl_os2.c;h=b698451b085d6af442eaa5b86d8cf2d90bcc2b5f;hb=e0e3c57ad9f042b7ff4eb12755ee3feaad30892b;hp=aaeeb580f4b713b4cf06a30468e7404ed0db7fa1;hpb=9fed8b87f0e66c26a1acaf42431d99e8f98aed9b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/os2/dl_os2.c b/os2/dl_os2.c index aaeeb58..b698451 100644 --- a/os2/dl_os2.c +++ b/os2/dl_os2.c @@ -8,21 +8,34 @@ static ULONG retcode; static char fail[300]; +#ifdef PERL_CORE + +#include "EXTERN.h" +#include "perl.h" + +#else + char *os2error(int rc); +#endif + void * -dlopen(char *path, int mode) +dlopen(const char *path, int mode) { HMODULE handle; - char tmp[260], *beg, *dot; + char tmp[260]; + const char *beg, *dot; ULONG rc; fail[0] = 0; - if ((rc = DosLoadModule(fail, sizeof fail, path, &handle)) == 0) + if ((rc = DosLoadModule(fail, sizeof fail, (char*)path, &handle)) == 0) return (void *)handle; retcode = rc; + if (strlen(path) >= sizeof(tmp)) + return NULL; + /* Not found. Check for non-FAT name and try truncated name. */ /* Don't know if this helps though... */ for (beg = dot = path + strlen(path); @@ -32,6 +45,7 @@ dlopen(char *path, int mode) dot = beg; if (dot - beg > 8) { int n = beg+8-path; + memmove(tmp, path, n); memmove(tmp+n, dot, strlen(dot)+1); if (DosLoadModule(fail, sizeof fail, tmp, &handle) == 0) @@ -42,7 +56,7 @@ dlopen(char *path, int mode) } void * -dlsym(void *handle, char *symbol) +dlsym(void *handle, const char *symbol) { ULONG rc, type; PFN addr;