Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df115f33 authored by Igor Murashkin's avatar Igor Murashkin Committed by Android Git Automerger
Browse files

am 858c8fe7: am d118394d: Merge "Properly handle cases of multiple inotify events" into jb-mr2-dev

* commit '858c8fe7':
  Properly handle cases of multiple inotify events
parents d15715e5 858c8fe7
Loading
Loading
Loading
Loading
+44 −39
Original line number Diff line number Diff line
@@ -223,12 +223,14 @@ int usb_host_read_event(struct usb_host_context *context)
    char event_buf[512];
    char path[100];
    int i, ret, done = 0;
    int j, event_size;
    int offset = 0;
    int wd;

    ret = read(context->fd, event_buf, sizeof(event_buf));
    if (ret >= (int)sizeof(struct inotify_event)) {
        event = (struct inotify_event *)event_buf;
        while (offset < ret) {
            event = (struct inotify_event*)&event_buf[offset];
            done = 0;
            wd = event->wd;
            if (wd == context->wdd) {
                if ((event->mask & IN_CREATE) && !strcmp(event->name, "bus")) {
@@ -274,6 +276,9 @@ int usb_host_read_event(struct usb_host_context *context)
                    }
                }
            }

            offset += sizeof(struct inotify_event) + event->len;
        }
    }

    return done;