udevng: fix removal of serial devices

Since the merge of udev.c into udevng.c all cleanup function must handle
both usb devices and serial devices. Add this distinction to
check_remove(), so that is doesn't try to iterate the .serial member as
if it were a .devices list.
This commit is contained in:
Martin Hundebøll 2018-08-24 13:33:30 +02:00 committed by Denis Kenzior
parent f9cde76095
commit 92a80db13f
1 changed files with 11 additions and 3 deletions

View File

@ -1380,11 +1380,19 @@ static gboolean check_remove(gpointer key, gpointer value, gpointer user_data)
const char *devpath = user_data;
GSList *list;
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
switch (modem->type) {
case MODEM_TYPE_USB:
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
if (g_strcmp0(info->devpath, devpath) == 0)
if (g_strcmp0(info->devpath, devpath) == 0)
return TRUE;
}
break;
case MODEM_TYPE_SERIAL:
if (g_strcmp0(modem->serial->devpath, devpath) == 0)
return TRUE;
break;
}
return FALSE;