About items 'bufs' and 'bufsml[4]' in uv_fs_t
bsdcpp opened this issue · 5 comments
Hi, everybody.
Sorry to trouble you, but I got problem when I played with your 'games'.
When I running my program(even your exercise answers), they all got "segmentation fault", I tracked them and found it should be here:
/* 4. Report the contents of the buffer */
log_report("%s", read_req->bufs->base);
log_info("%s", read_req->bufs->base);
because when it come into the callback, read_req->bufs turned to NULL, but I can use
read_req->bufsml->base to make it work.
I run into the same "segmentation fault" too, have to define a static uv_buf_t iov
then read and log that out to pass exercise 4.
@thlorenz : could you provide more info on this?
BR and thank you for the tutorial!
So as the rest of the exercises which need to get buf content?
I had updated to libuv v1.9.1, req->bufs is also NULL.
the req->bufs and bufsml are not public fields, you shouldn't rely on them. Embed the uv_fs_t request into your own structure to keep track of the buffers. Same applies to uv_write_t for example.
Don't have bandwidth to look at this, but PRs are certainly welcome :)