mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
registry, ptp: Canonicalize the library path returned by dladdr
On systems using UsrMerge (like openSUSE or Fedora), /lib64 is a symlink to /usr/lib64. So dladdr is returning the path to the gstreamer library in /lib64 in priv_gst_get_relocated_libgstreamer. Later gst_plugin_loader_spawn tries to build the path to the gst-plugin-scanner helper from /lib64 and ends up trying to use /lib64/../libexec/gstreamer-1.0/gst-plugin-scanner which doesn't exist. By canonicalizing the path with a call to realpath, gst-plugin-scanner is found correctly under /usr/lib64/../libexec/gstreamer-1.0/gst-plugin-scanner Similar change applied to gstreamer/libs/gst/net/gstptpclock.c Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6343>
This commit is contained in:
parent
45ce449854
commit
89041ad29d
2 changed files with 40 additions and 2 deletions
|
@ -1599,6 +1599,8 @@ priv_gst_get_relocated_libgstreamer (void)
|
|||
#elif defined(HAVE_DLADDR)
|
||||
{
|
||||
Dl_info info;
|
||||
char *real_fname = NULL;
|
||||
long path_max = 0;
|
||||
|
||||
GST_DEBUG ("attempting to retrieve libgstreamer-1.0 location using "
|
||||
"dladdr()");
|
||||
|
@ -1609,8 +1611,25 @@ priv_gst_get_relocated_libgstreamer (void)
|
|||
if (!info.dli_fname) {
|
||||
return NULL;
|
||||
}
|
||||
#ifdef PATH_MAX
|
||||
path_max = PATH_MAX;
|
||||
#else
|
||||
path_max = pathconf (info.dli_fname, _PC_PATH_MAX);
|
||||
if (path_max <= 0)
|
||||
path_max = 4096;
|
||||
#endif
|
||||
|
||||
real_fname = g_malloc (path_max);
|
||||
if (realpath (info.dli_fname, real_fname)) {
|
||||
dir = g_path_get_dirname (real_fname);
|
||||
GST_DEBUG ("real directory location: %s", dir);
|
||||
} else {
|
||||
GST_ERROR ("could not canonicalize path %s: %s", info.dli_fname,
|
||||
g_strerror (errno));
|
||||
dir = g_path_get_dirname (info.dli_fname);
|
||||
}
|
||||
g_free (real_fname);
|
||||
|
||||
} else {
|
||||
GST_LOG ("dladdr() failed");
|
||||
return NULL;
|
||||
|
|
|
@ -2569,6 +2569,8 @@ get_relocated_libgstnet (void)
|
|||
#elif defined(HAVE_DLADDR)
|
||||
{
|
||||
Dl_info info;
|
||||
char *real_fname = NULL;
|
||||
long path_max = 0;
|
||||
|
||||
GST_DEBUG ("attempting to retrieve libgstnet-1.0 location using "
|
||||
"dladdr()");
|
||||
|
@ -2579,8 +2581,25 @@ get_relocated_libgstnet (void)
|
|||
if (!info.dli_fname) {
|
||||
return NULL;
|
||||
}
|
||||
#ifdef PATH_MAX
|
||||
path_max = PATH_MAX;
|
||||
#else
|
||||
path_max = pathconf (info.dli_fname, _PC_PATH_MAX);
|
||||
if (path_max <= 0)
|
||||
path_max = 4096;
|
||||
#endif
|
||||
|
||||
real_fname = g_malloc (path_max);
|
||||
if (realpath (info.dli_fname, real_fname)) {
|
||||
dir = g_path_get_dirname (real_fname);
|
||||
GST_DEBUG ("real directory location: %s", dir);
|
||||
} else {
|
||||
GST_ERROR ("could not canonicalize path %s: %s", info.dli_fname,
|
||||
g_strerror (errno));
|
||||
dir = g_path_get_dirname (info.dli_fname);
|
||||
}
|
||||
g_free (real_fname);
|
||||
|
||||
} else {
|
||||
GST_LOG ("dladdr() failed");
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue