Continue inotify event handling even after failure in one event

If read() on the inotify handle gave us several events at once, and handling
one of them resulted in whatever error, there is little reason not to try
handling the rest of the events.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Stefan Richter 2012-02-05 12:02:37 +01:00
parent c6569f39f1
commit 2094c86d5c
1 changed files with 2 additions and 4 deletions

View File

@ -434,16 +434,14 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
{
fw_handle_t fwhandle = handle->mode.fw;
struct inotify_event *event;
int len;
ssize_t len;
int retval = 0;
event = (struct inotify_event *) fwhandle->buffer;
len = read(fwhandle->inotify_fd, event, BUFFER_SIZE);
while (len >= sizeof(struct inotify_event)) {
retval = process_inotify_event(fwhandle, event);
if (retval == -1)
break;
retval |= process_inotify_event(fwhandle, event);
len -= sizeof(struct inotify_event) + event->len;
event = (struct inotify_event *) ((char *)event +
(sizeof(struct inotify_event) + event->len));