ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/modules.c
(Generate patch)

Comparing ircd-hybrid-8/src/modules.c (file contents):
Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC vs.
Revision 1404 by michael, Thu May 10 20:41:45 2012 UTC

# Line 142 | Line 142 | unload_one_module(const char *name, int
142   * side effects - loads a module if successful
143   */
144   int
145 < load_a_module(const char *path, int warn, int core)
145 > load_a_module(const char *path, int warn)
146   {
147    lt_dlhandle tmpptr = NULL;
148    const char *mod_basename = NULL;
# Line 174 | Line 174 | load_a_module(const char *path, int warn
174    if (EmptyString(modp->version))
175      modp->version = unknown_ver;
176  
177  if (core)
178    modp->flags |= MODULE_FLAG_CORE;
179
177    DupString(modp->name, mod_basename);
178    dlinkAdd(modp, &modp->node, &modules_list);
179  
# Line 229 | Line 226 | static struct module_path *
226   mod_find_path(const char *path)
227   {
228    dlink_node *ptr;
232  struct module_path *mpath;
229  
230    DLINK_FOREACH(ptr, mod_paths.head)
231    {
232 <    mpath = ptr->data;
232 >    struct module_path *mpath = ptr->data;
233  
234      if (!strcmp(path, mpath->path))
235        return mpath;
# Line 288 | Line 284 | add_conf_module(const char *name)
284   void
285   mod_clear_paths(void)
286   {
291  struct module_path *pathst = NULL;
287    dlink_node *ptr = NULL, *next_ptr = NULL;
288  
289    DLINK_FOREACH_SAFE(ptr, next_ptr, mod_paths.head)
290    {
291 <    pathst = ptr->data;
292 <
298 <    dlinkDelete(&pathst->node, &mod_paths);
299 <    MyFree(pathst);
291 >    dlinkDelete(ptr, &mod_paths);
292 >    MyFree(ptr->data);
293    }
294  
295    DLINK_FOREACH_SAFE(ptr, next_ptr, conf_modules.head)
296    {
297 <    pathst = ptr->data;
298 <
306 <    dlinkDelete(&pathst->node, &conf_modules);
307 <    MyFree(pathst);
297 >    dlinkDelete(ptr, &conf_modules);
298 >    MyFree(ptr->data);
299    }
300   }
301  
# Line 343 | Line 334 | load_all_modules(int warn)
334    struct dirent *ldirent = NULL;
335    char module_fq_name[PATH_MAX + 1];
336  
346  modules_init();
347
337    if ((system_module_dir = opendir(AUTOMODPATH)) == NULL)
338    {
339      ilog(LOG_TYPE_IRCD, "Could not load modules from %s: %s",
# Line 358 | Line 347 | load_all_modules(int warn)
347      {
348         snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s",
349                  AUTOMODPATH, ldirent->d_name);
350 <       load_a_module(module_fq_name, warn, 0);
350 >       load_a_module(module_fq_name, warn);
351      }
352    }
353  
# Line 375 | Line 364 | void
364   load_conf_modules(void)
365   {
366    dlink_node *ptr = NULL;
378  struct module_path *mpath = NULL;
367  
368    DLINK_FOREACH(ptr, conf_modules.head)
369    {
370 <    mpath = ptr->data;
370 >    struct module_path *mpath = ptr->data;
371  
372      if (findmodule_byname(mpath->path) == NULL)
373 <      load_one_module(mpath->path, 0);
373 >      load_one_module(mpath->path);
374    }
375   }
376  
# Line 403 | Line 391 | load_core_modules(int warn)
391      snprintf(module_name, sizeof(module_name), "%s%s",
392               MODPATH, core_module_table[i]);
393  
394 <    if (load_a_module(module_name, warn, 1) == -1)
394 >    if (load_a_module(module_name, warn) == -1)
395      {
396        ilog(LOG_TYPE_IRCD, "Error loading core module %s: terminating ircd",
397             core_module_table[i]);
# Line 420 | Line 408 | load_core_modules(int warn)
408   * side effects - module is loaded if found.
409   */
410   int
411 < load_one_module(const char *path, int coremodule)
411 > load_one_module(const char *path)
412   {
413    dlink_node *ptr = NULL;
414    char modpath[PATH_MAX + 1];
# Line 437 | Line 425 | load_one_module(const char *path, int co
425  
426      if (strstr(modpath, "../") == NULL &&
427          strstr(modpath, "/..") == NULL)
440    {
428        if (!stat(modpath, &statbuf))
429 <      {
430 <        if (S_ISREG(statbuf.st_mode))
444 <        {
445 <          /* Regular files only please */
446 <          return load_a_module(modpath, 1, coremodule);
447 <        }
448 <      }
449 <    }
429 >        if (S_ISREG(statbuf.st_mode))  /* Regular files only please */
430 >          return load_a_module(modpath, 1);
431    }
432  
433    sendto_realops_flags(UMODE_ALL, L_ALL,
# Line 478 | Line 459 | mo_modload(struct Client *client_p, stru
459      return;
460    }
461  
462 <  load_one_module(parv[1], 0);
462 >  load_one_module(parv[1]);
463   }
464  
465   /* unload a module .. */
# Line 554 | Line 535 | mo_modreload(struct Client *client_p, st
535      return;
536    }
537  
538 <  if ((load_one_module(parv[1], check_core) == -1) && check_core)
538 >  if ((load_one_module(parv[1]) == -1) && check_core)
539    {
540      sendto_realops_flags(UMODE_ALL, L_ALL, "Error reloading core "
541                           "module: %s: terminating ircd", parv[1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines