Reset device fd upon error condition in handle_inotify()

If an error is encountered while adding a new device in inotify
handling, make sure the fd is marked invalid (-1).

Signed-off-by: Peter Hurley <phurley@charter.net>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Peter Hurley 2010-10-27 09:28:24 -04:00 committed by Stefan Richter
parent 8e433bf584
commit ea4acf08bc
1 changed files with 1 additions and 0 deletions

View File

@ -426,6 +426,7 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
ep.data.ptr = &fwhandle->devices[i].closure;
if (epoll_ctl(fwhandle->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
close(fd);
fwhandle->devices[i].fd = -1;
return -1;
}