From 6ec3a7308eb02cdbe654109be02f544da194a655 Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Wed, 6 Jul 2016 16:07:25 +0300 Subject: [PATCH] [udev] Fix udev iowatch issues The io watch source id is not cleared when it is going to be implicitly removed - which can lead to unsuccessful removal attempt when/if hwal_cleanup() function is called later on. Clear watch_id when return value from the callback function is going to cause it to be implicitly removed. Signed-off-by: Simo Piiroinen --- src/usb_moded-udev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/usb_moded-udev.c b/src/usb_moded-udev.c index 62c49c5..7f7fae1 100644 --- a/src/usb_moded-udev.c +++ b/src/usb_moded-udev.c @@ -264,8 +264,9 @@ static gboolean monitor_udev(GIOChannel *iochannel G_GNUC_UNUSED, GIOCondition c release_wakelock(USB_MODED_WAKELOCK_PROCESS_INPUT); - if (!continue_watching) + if (!continue_watching && watch_id ) { + watch_id = 0; log_crit("udev io watch disabled"); }