Sun Sep 26 19:37:30 PDT 1999
(Mandrake) added patch from Martin Tyler <martin@boo.org> fixes segfaults in modules loading with ipc. SVN revision: 402
This commit is contained in:
parent
d26103f636
commit
da0c241fa4
|
@ -2381,3 +2381,12 @@ Sat Sep 25 13:07:52 PDT 1999
|
|||
(Raster)
|
||||
|
||||
add mroe to the color modifiers comment dialog...
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Sun Sep 26 19:37:30 PDT 1999
|
||||
(Mandrake)
|
||||
|
||||
added patch from Martin Tyler <martin@boo.org>
|
||||
fixes segfaults in modules loading with ipc.
|
||||
|
||||
|
|
|
@ -613,9 +613,15 @@ IPC_Modules(char *params, Client * c)
|
|||
{
|
||||
char param1[FILEPATH_LEN_MAX];
|
||||
char param2[FILEPATH_LEN_MAX];
|
||||
char param3[FILEPATH_LEN_MAX];
|
||||
|
||||
param1[0] = 0;
|
||||
param2[0] = 0;
|
||||
param3[0] = 0;
|
||||
|
||||
word(params, 1, param1);
|
||||
word(params, 2, param2);
|
||||
word(params, 3, param3);
|
||||
if (!strcmp(param1, "load"))
|
||||
{
|
||||
if (!param2[0])
|
||||
|
|
|
@ -21,6 +21,7 @@ typedef struct _ModuleMember
|
|||
}
|
||||
ModuleMember;
|
||||
|
||||
int ListLength = 0;
|
||||
ModuleMember *ModuleList;
|
||||
|
||||
/* This is a few of our return code DEFINES */
|
||||
|
@ -29,6 +30,7 @@ ModuleMember *ModuleList;
|
|||
#define MODULE_LOAD_FAIL 2
|
||||
#define MODULE_UNLOAD_FAIL 3
|
||||
#define MODULE_NOT_LOADED 4
|
||||
#define MODULE_EXEC_FAIL 5
|
||||
|
||||
int
|
||||
LoadModule(char *module_name)
|
||||
|
@ -56,20 +58,17 @@ LoadModule(char *module_name)
|
|||
/* create or append to ModuleList? */
|
||||
if (ModuleList)
|
||||
{
|
||||
ModuleList = Erealloc(ModuleList,
|
||||
((sizeof(ModuleList) / sizeof(ModuleMember) + 1) *
|
||||
sizeof(ModuleMember)));
|
||||
ModuleList = Erealloc(ModuleList, ++ListLength * sizeof(ModuleMember));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModuleList = Emalloc(sizeof(ModuleMember));
|
||||
ListLength = 1;
|
||||
}
|
||||
|
||||
/* Now we'll chunk everything useful into the ModuleList */
|
||||
ModuleList[(sizeof(ModuleList) / sizeof(ModuleMember) - 1)].ModuleName
|
||||
= duplicate(module_name);
|
||||
ModuleList[(sizeof(ModuleList) / sizeof(ModuleMember) - 1)].handle =
|
||||
handle;
|
||||
ModuleList[ListLength - 1].ModuleName = duplicate(module_name);
|
||||
ModuleList[ListLength - 1].handle = handle;
|
||||
|
||||
return (0);
|
||||
|
||||
|
@ -79,7 +78,6 @@ int
|
|||
UnloadModule(char *module_name)
|
||||
{
|
||||
|
||||
int ListLength = 0;
|
||||
int ModuleID;
|
||||
int i;
|
||||
|
||||
|
@ -89,8 +87,6 @@ UnloadModule(char *module_name)
|
|||
/* fix the ModuleID */
|
||||
ModuleID--;
|
||||
|
||||
ListLength = (sizeof(ModuleList) / sizeof(ModuleMember));
|
||||
|
||||
if (dlclose(ModuleList[ModuleID].handle))
|
||||
return (MODULE_UNLOAD_FAIL);
|
||||
|
||||
|
@ -103,8 +99,7 @@ UnloadModule(char *module_name)
|
|||
ModuleList[i].handle = ModuleList[i + 1].handle;
|
||||
}
|
||||
|
||||
ModuleList = Erealloc(ModuleList, ((sizeof(ModuleList) / sizeof(ModuleMember)
|
||||
- 1) * sizeof(ModuleMember)));
|
||||
ModuleList = Erealloc(ModuleList, --ListLength * sizeof(ModuleMember));
|
||||
|
||||
return (0);
|
||||
|
||||
|
@ -136,13 +131,10 @@ char *
|
|||
ModuleListAsString(void)
|
||||
{
|
||||
|
||||
int ListLength = 0;
|
||||
int i;
|
||||
|
||||
char returnList[FILEPATH_LEN_MAX];
|
||||
|
||||
ListLength = (sizeof(ModuleList) / sizeof(ModuleMember));
|
||||
|
||||
returnList[0] = 0;
|
||||
|
||||
strcat(returnList, "");
|
||||
|
@ -167,11 +159,8 @@ IsLoadedModule(char *module_name)
|
|||
* --Mandrake
|
||||
*/
|
||||
|
||||
int ListLength = 0;
|
||||
int i;
|
||||
|
||||
ListLength = (sizeof(ModuleList) / sizeof(ModuleMember));
|
||||
|
||||
for (i = 0; i < ListLength; i++)
|
||||
{
|
||||
if (!strcmp(ModuleList[i].ModuleName, module_name))
|
||||
|
|
Loading…
Reference in New Issue