> Let's say it returns a value of 8192 instead, setting errno to EINTR.
errno is meaningful only after the function failed. Short write doesn't count as failure.
errno is meaningful only after the function failed. Short write doesn't count as failure.
After a short write your only legitimate course of action is to advance the pointer and write again.
> The fwrite() function shall return the number of elements successfully written, which may be less than nitems if a write error is encountered
> if a write error occurs, the error indicator for the stream shall be set, and errno shall be set to indicate the error