User: Password:
Subscribe / Log in / New account

Ensuring data reaches disk

Ensuring data reaches disk

Posted Sep 9, 2011 19:00 UTC (Fri) by valyala (guest, #41196)
In reply to: Ensuring data reaches disk by jvoss2
Parent article: Ensuring data reaches disk

No. read(2) returns zero on the end of file. In our case this means that the incoming connection has been closed. The code just returns success (0) in this case, while not all the requested data has been read. The drawback of this design decision is that the caller of sock_read() cannot determine this case. It would be better returning the number of actual bytes written to the output file instead of just 'success/failure' code.

(Log in to post comments)

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds