You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.9 KiB

  1. Index: libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23/src/extensions.c
  2. ===================================================================
  3. --- libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23.orig/src/extensions.c
  4. +++ libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23/src/extensions.c
  5. @@ -123,11 +123,14 @@ lyext_load_plugins(void)
  6. /* and construct the filepath */
  7. asprintf(&str, "%s/%s", pluginsdir, file->d_name);
  8. -
  9. - /* load the plugin - first, try if it is already loaded... */
  10. - dlhandler = dlopen(str, RTLD_NOW | RTLD_NOLOAD);
  11. - dlerror(); /* Clear any existing error */
  12. - if (dlhandler) {
  13. + /* load the plugin */
  14. + dlhandler = dlopen(str, RTLD_NOW);
  15. + if (!dlhandler) {
  16. + LOGERR(LY_ESYS, "Loading \"%s\" as a plugin failed (%s).", str, dlerror());
  17. + free(str);
  18. + continue;
  19. + }
  20. + if (ly_set_contains(&dlhandlers, dlhandler) != -1) {
  21. /* the plugin is already loaded */
  22. LOGVRB("Extension plugin \"%s\" already loaded.", str);
  23. free(str);
  24. @@ -137,14 +140,6 @@ lyext_load_plugins(void)
  25. continue;
  26. }
  27. - /* ... and if not, load it */
  28. - dlhandler = dlopen(str, RTLD_NOW);
  29. - if (!dlhandler) {
  30. - LOGERR(LY_ESYS, "Loading \"%s\" as an extension plugin failed (%s).", str, dlerror());
  31. - free(str);
  32. - continue;
  33. - }
  34. - LOGVRB("Extension plugin \"%s\" successfully loaded.", str);
  35. free(str);
  36. dlerror(); /* Clear any existing error */
  37. @@ -156,6 +151,7 @@ lyext_load_plugins(void)
  38. dlclose(dlhandler);
  39. continue;
  40. }
  41. + LOGVRB("Plugin \"%s\" successfully loaded.", str)
  42. for(u = 0; plugin[u].name; u++) {
  43. /* check extension implementations for collisions */