do_iterative_fd_io():

* When do_iterative_fd_io_iterate() fails, we must not invoke the
  supplied finished hook explicitly, since it is invoked indirectly by
  request->SetStatusAndNotify() anyway. Should fix #2557.
* We must detach the descriptor putter as soon as we have adjusted the
  request's finished callback, since that will put the descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26776 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-08-04 02:57:03 +00:00
parent bca3215f8a
commit be87a4934e

View File

@ -440,6 +440,9 @@ do_iterative_fd_io(int fd, io_request* request, iterative_io_get_vecs getVecs,
request->SetFinishedCallback(&do_iterative_fd_io_finish, iterationCookie);
request->SetIterationCallback(&do_iterative_fd_io_iterate, iterationCookie);
descriptorPutter.Detach();
// From now on the descriptor is put by our finish callback.
bool partialTransfer = false;
status_t error = do_iterative_fd_io_iterate(iterationCookie, request,
&partialTransfer);
@ -449,13 +452,9 @@ do_iterative_fd_io(int fd, io_request* request, iterative_io_get_vecs getVecs,
request->TransferredBytes());
}
finished(cookie, request, error, request->IsPartialTransfer(),
request->TransferredBytes());
request->SetStatusAndNotify(error);
return error;
}
descriptorPutter.Detach();
return B_OK;
}