From 3594f2ee45f72379ee13f079151a49d83083f625 Mon Sep 17 00:00:00 2001 From: griever Date: Thu, 27 Dec 2001 05:59:05 +0000 Subject: [PATCH] Made it so "modulename.so" -> "./modulename.so"` --- Changes | 2 ++ src/modules.c | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 516f072d9..3f4c7fe07 100644 --- a/Changes +++ b/Changes @@ -1038,3 +1038,5 @@ seen. gmtime warning still there found by HA|Raptor - If host == null, don't set it (m_oper, was setting it to "eek.host.is.null.pointer") - Small fix for #427583 mode bug +- Fixed it so /module load doesnt require you to do ./module.so if the module is in + current dir diff --git a/src/modules.c b/src/modules.c index b263c2a84..5fa839fdb 100644 --- a/src/modules.c +++ b/src/modules.c @@ -83,7 +83,7 @@ Module *Module_Find(char *name) /* * Returns an error if insucessful .. yes NULL is OK! */ -char *Module_Load (char *path, int load) +char *Module_Load (char *path_, int load) { #ifndef STATIC_LINKING #ifdef _WIN32 @@ -95,11 +95,21 @@ char *Module_Load (char *path, int load) int (*Mod_Load)(); int (*Mod_Unload)(); static char errorbuf[1024]; + char *path; ModuleHeader *mod_header; int ret = 0; Module *mod = NULL; Debug((DEBUG_DEBUG, "Attempting to load module from %s", - path)); + path_)); + path = path_; + + if(!strchr(path, '/')) + { + path = malloc(strlen(path) + 3); + strcpy(path, "./"); + strcat(path, path_); + } + if ((Mod = irc_dlopen(path, RTLD_NOW))) { /* We have engaged the borg cube. Scan for lifesigns. */ @@ -193,7 +203,9 @@ char *Module_Load (char *path, int load) /* Return the error .. */ return ((char *)irc_dlerror()); } - + + if (path != path_) + free(path); #else /* !STATIC_LINKING */ return "We don't support dynamic linking";