Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/file


Modified Files:
        evas_module.c 


Log Message:


anmd fix dlopen link detection , actually check for dladdr as it's a gnu
extension etc.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/file/evas_module.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_module.c       14 Jan 2006 12:13:36 -0000      1.1
+++ evas_module.c       14 Jan 2006 12:36:25 -0000      1.2
@@ -53,7 +53,6 @@
    char *path;
    int i;
    Evas_List *paths = NULL;
-   Dl_info evas_dl;
    
    /* 1. ~/.evas/modules/ */
    prefix = getenv("HOME");
@@ -65,23 +64,36 @@
      paths = evas_list_append(paths,path);
    else
      free(path);
-   
+
 #ifdef HAVE_DLADDR
-   if (dladdr(evas_module_paths_init, &evas_dl))
      {
-       int length;
-       
-       length = strlen(rindex(evas_dl.dli_fname, '/'));
-       path = malloc(strlen(evas_dl.dli_fname) - length + 
strlen("/evas/modules") + 1);
-       strncpy(path, evas_dl.dli_fname, strlen(evas_dl.dli_fname) - length);
-       strcat(path, "/evas/modules");
-       if (evas_file_path_exists(path))
-         paths = evas_list_append(paths, path);
-       else
-         free(path);
+       Dl_info evas_dl;
+       /* 3. libevas.so/../evas/modules/ */
+       if (dladdr(evas_module_paths_init, &evas_dl))
+         {
+            int length;
+            
+            if (strrchr(evas_dl.dli_fname, '/'))
+              {
+                 length = strlen(strrchr(evas_dl.dli_fname, '/'));
+                 path = malloc(strlen(evas_dl.dli_fname) - length + 
+                               strlen("/evas/modules") + 1);
+                 if (path)
+                   {
+                      strncpy(path, evas_dl.dli_fname, 
+                              strlen(evas_dl.dli_fname) - length);
+                      path[strlen(evas_dl.dli_fname) - length] = 0;
+                      strcat(path, "/evas/modules");
+                      if (evas_file_path_exists(path))
+                        paths = evas_list_append(paths, path);
+                      else
+                        free(path);
+                   }
+              }
+         }
      }
 #else
-   /* 2. PREFIX/evas/modules/ */
+   /* 3. PREFIX/evas/modules/ */
    prefix = PACKAGE_LIB_DIR; 
    path = malloc(strlen(prefix) + 1 + strlen("/evas/modules"));
    strcpy(path, prefix);




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to