kerneldevice: fix build with musl libc
musl libc does not implement the canonicalize_file_name() GNU extension. Use the POSIX standard realpath() instead.
This commit is contained in:
committed by
Aleksander Morgado
parent
cf3f3ffcd0
commit
105e321951
@@ -120,7 +120,7 @@ preload_sysfs_path (MMKernelDeviceGeneric *self)
|
||||
mm_kernel_event_properties_get_subsystem (self->priv->properties),
|
||||
mm_kernel_event_properties_get_name (self->priv->properties));
|
||||
|
||||
self->priv->sysfs_path = canonicalize_file_name (tmp);
|
||||
self->priv->sysfs_path = realpath (tmp, NULL);
|
||||
if (!self->priv->sysfs_path || !g_file_test (self->priv->sysfs_path, G_FILE_TEST_EXISTS)) {
|
||||
mm_warn ("Invalid sysfs path read for %s/%s",
|
||||
mm_kernel_event_properties_get_subsystem (self->priv->properties),
|
||||
@@ -163,7 +163,7 @@ preload_interface_sysfs_path (MMKernelDeviceGeneric *self)
|
||||
* The correct parent dir we want to have is the first one with "usb" subsystem.
|
||||
*/
|
||||
aux = g_strdup_printf ("%s/device", self->priv->sysfs_path);
|
||||
dirpath = canonicalize_file_name (aux);
|
||||
dirpath = realpath (aux, NULL);
|
||||
g_free (aux);
|
||||
|
||||
while (dirpath) {
|
||||
@@ -179,7 +179,7 @@ preload_interface_sysfs_path (MMKernelDeviceGeneric *self)
|
||||
gchar *canonicalized_subsystem;
|
||||
gchar *subsystem_name;
|
||||
|
||||
canonicalized_subsystem = canonicalize_file_name (subsystem_filepath);
|
||||
canonicalized_subsystem = realpath (subsystem_filepath, NULL);
|
||||
g_free (subsystem_filepath);
|
||||
|
||||
subsystem_name = g_path_get_basename (canonicalized_subsystem);
|
||||
@@ -239,7 +239,7 @@ preload_driver (MMKernelDeviceGeneric *self)
|
||||
gchar *tmp2;
|
||||
|
||||
tmp = g_strdup_printf ("%s/driver", self->priv->interface_sysfs_path);
|
||||
tmp2 = canonicalize_file_name (tmp);
|
||||
tmp2 = realpath (tmp, NULL);
|
||||
if (tmp2 && g_file_test (tmp2, G_FILE_TEST_EXISTS))
|
||||
self->priv->driver = g_path_get_basename (tmp2);
|
||||
g_free (tmp2);
|
||||
@@ -308,7 +308,7 @@ preload_physdev_subsystem (MMKernelDeviceGeneric *self)
|
||||
gchar *subsyspath;
|
||||
|
||||
aux = g_strdup_printf ("%s/subsystem", self->priv->physdev_sysfs_path);
|
||||
subsyspath = canonicalize_file_name (aux);
|
||||
subsyspath = realpath (aux, NULL);
|
||||
self->priv->physdev_subsystem = g_path_get_dirname (subsyspath);
|
||||
g_free (subsyspath);
|
||||
g_free (aux);
|
||||
|
||||
Reference in New Issue
Block a user