From e36ad522d60cd032a1ab15229b1a56bd7288c348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 8 Dec 2013 11:34:07 +0100 Subject: [PATCH] Fix 24d0e21f51e88ab35cc3f1c1750741dfeb40933d correctly CreateSubRequest() could still return an error and break out of the while loop without exiting the outer for loop. Instead we reset the error code before entering the for loop. --- src/system/kernel/fs/vfs_request_io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/fs/vfs_request_io.cpp b/src/system/kernel/fs/vfs_request_io.cpp index 1aefcc3081..ffd05a75c2 100644 --- a/src/system/kernel/fs/vfs_request_io.cpp +++ b/src/system/kernel/fs/vfs_request_io.cpp @@ -163,9 +163,14 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request, } TRACE_RIO("[%ld] got %zu file vecs\n", find_thread(NULL), vecCount); + // Reset the error code for the loop below + error = B_OK; + // create subrequests for the file vecs we've got size_t subRequestCount = 0; - for (size_t i = 0; i < vecCount && subRequestCount < kMaxSubRequests; i++) { + for (size_t i = 0; + i < vecCount && subRequestCount < kMaxSubRequests && error == B_OK; + i++) { off_t vecOffset = vecs[i].offset; off_t vecLength = min_c(vecs[i].length, (off_t)requestLength); TRACE_RIO("[%ld] vec %lu offset: %lld, length: %lld\n",