mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 05:30:03 +01:00
linux: up-enumerator-udev: Prevent reading the sysfs path from a non-GUdevDevice object
A non-GUdevDevice object may be included in the sibling device list, since the udev information was created slowly. This object triggers errors when upower tries to get udev information. Therefore, get_latest_udev_device() returns NULL, when it receives a non-GUdevDevice object. The error messages are shown as follows: (upowerd:2026931): GUdev-CRITICAL **: 10:38:29.775: g_udev_device_get_sysfs_path: assertion 'G_UDEV_IS_DEVICE (device)' failed (upowerd:2026931): GUdev-CRITICAL **: 10:38:29.775: g_udev_client_query_by_sysfs_path: assertion 'sysfs_path != NULL' failed
This commit is contained in:
parent
7ae19b529f
commit
38317a118d
1 changed files with 6 additions and 0 deletions
|
|
@ -178,6 +178,12 @@ get_latest_udev_device (UpEnumeratorUdev *self,
|
|||
{
|
||||
const char *sysfs_path;
|
||||
|
||||
/* return NULL when receiving a non-GUdevDevice object */
|
||||
if (!G_UDEV_IS_DEVICE (obj)) {
|
||||
g_debug ("Receiving a non-udev object.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sysfs_path = g_udev_device_get_sysfs_path (G_UDEV_DEVICE (obj));
|
||||
return g_udev_client_query_by_sysfs_path (self->udev, sysfs_path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue