summaryrefslogtreecommitdiffstats
path: root/libusbhost
diff options
context:
space:
mode:
authorBo Huang <bo.b.huang@intel.com>2014-01-21 14:25:22 +0800
committerBo Huang <bo.b.huang@intel.com>2014-04-25 13:56:38 +0800
commit3c1d7b34c151ec1669e0d190a0839718242682c9 (patch)
treed1bf0eeea370dfcbcfc487843ca995fd0bc8dfb7 /libusbhost
parent0607e104c2db2a3e115fd9b49ea85cbc03dbcd1f (diff)
downloadsystem_core-3c1d7b34c151ec1669e0d190a0839718242682c9.zip
system_core-3c1d7b34c151ec1669e0d190a0839718242682c9.tar.gz
system_core-3c1d7b34c151ec1669e0d190a0839718242682c9.tar.bz2
libusbhost: Fix issue of multiple inotify event at same time.
libusbhost can handle multiple inotify events at same time on Kit kat. In original implementation, the function-level ret is assigned with length of read and used for while loop. if want to add a new watch for subdirectory,inotify_add_watch will update the function-level ret with watch descriptor. It impact on while loop to do exit. Add local result to avoid it. Change-Id: I101041ccfd54eaac14969a45e90ab2e49bdff578 Signed-off-by: Bo Huang <bo.b.huang@intel.com>
Diffstat (limited to 'libusbhost')
-rw-r--r--libusbhost/usbhost.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c
index 8be393e..cd8000a 100644
--- a/libusbhost/usbhost.c
+++ b/libusbhost/usbhost.c
@@ -263,11 +263,12 @@ int usb_host_read_event(struct usb_host_context *context)
D("%s subdirectory %s: index: %d\n", (event->mask & IN_CREATE) ?
"new" : "gone", path, i);
if (i > 0 && i < MAX_USBFS_WD_COUNT) {
+ int local_ret = 0;
if (event->mask & IN_CREATE) {
- ret = inotify_add_watch(context->fd, path,
+ local_ret = inotify_add_watch(context->fd, path,
IN_CREATE | IN_DELETE);
- if (ret >= 0)
- context->wds[i] = ret;
+ if (local_ret >= 0)
+ context->wds[i] = local_ret;
done = find_existing_devices_bus(path, context->cb_added,
context->data);
} else if (event->mask & IN_DELETE) {