3 ms·
This precise issue in Unix/POSIX causes a huge headache. I wonder how many thousands or millions of "xread/xwrite" loops have been written in user code to retr
by rwmj 15y ago
This precise issue in Unix/POSIX causes a huge headache. I wonder how many thousands or millions of "xread/xwrite" loops have been written in user code to retry failed read and write calls, and how many of those loops have bugs?
Look at gnulib to see how hard it is to get these loops right:
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/full-write.c;h=b94f95fbb1f576cbde541e0fc4f965a624eb7028;hb=HEAD#l51 http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=li...
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/safe-read.c;h=d9cb3308d0cc887320d33b1c8b609fc59492b9b6;hb=HEAD#l52 http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=li...
In the case of a partial read/write followed by an error, I don't believe it is possible to recover at all using just POSIX-defined calls.