From: raster Date: Sun, 24 Apr 2011 09:53:00 +0000 (+0000) Subject: fix bug when dladdr doesnt return full path. odd that it doesnt. X-Git-Tag: 2.0_alpha~70^2~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=517b19eab2ddcd09ef751d889118e0dfd12f964c;p=framework%2Fuifw%2Feina.git fix bug when dladdr doesnt return full path. odd that it doesnt. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@58865 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/eina_prefix.c b/src/lib/eina_prefix.c index d0b38c8..6174591 100644 --- a/src/lib/eina_prefix.c +++ b/src/lib/eina_prefix.c @@ -175,9 +175,9 @@ _try_argv(Eina_Prefix *pfx, const char *argv0) /* 1. is argv0 abs path? */ #ifdef _WIN32 - if (argv0[0] && (argv0[1] == ':')) + if (argv0[0] && (argv0[1] == PSEP_C)) #else - if (argv0[0] == '/') + if (argv0[0] == DSEP_C) #endif { STRDUP_REP(pfx->exe_path, argv0); @@ -454,7 +454,15 @@ eina_prefix_new(const char *argv0, void *symbol, const char *envprefix, if (dladdr(symbol, &info_dl)) { - STRDUP_REP(pfx->exe_path, info_dl.dli_fname); + if (info_dl.dli_fname) + { +#ifdef _WIN32 + if (info_dl.dli_fname[0] && (info_dl.dli_fname[0] == PSEP_C)) +#else + if (info_dl.dli_fname[0] == DSEP_C) +#endif + STRDUP_REP(pfx->exe_path, info_dl.dli_fname); + } } } #endif @@ -531,12 +539,16 @@ eina_prefix_new(const char *argv0, void *symbol, const char *envprefix, } /* magic file not there. time to start hunting! */ else - _fallback(pfx, pkg_bin, pkg_lib, pkg_data, - pkg_locale, envprefix); + { + _fallback(pfx, pkg_bin, pkg_lib, pkg_data, + pkg_locale, envprefix); + } } else - _fallback(pfx, pkg_bin, pkg_lib, pkg_data, pkg_locale, - envprefix); + { + _fallback(pfx, pkg_bin, pkg_lib, pkg_data, pkg_locale, + envprefix); + } return pfx; } p--;