On 12/5/06, Andrew Church <[EMAIL PROTECTED]> wrote:
>Looks that the right thing to do is to make tc_pwrite (and family) to
>return -1 if errno != EINTR happens.
>(Andrew, any objections?)

     Well, the problem is how do you handle partial writes?  Is there a
case in which an error occurs but the caller would want to know how much
data was successfully written?  If not, you could just change the
interface to return a boolean 1 (all data successfully written) or 0
(error), though it would obviously be better to give such a routine a
different name and change the current code over manually.  Otherwise, it
should probably act like a write() that doesn't return EINTR: i.e., if an
error occurs after writing some data out, it should return the number of
bytes successfully written, not -1.

Personally I've found that knowing about a partial write is useless.
If you only wrote part of it, there was probably an error that you
want to report anyways.  That's the whole point of a wrapper like
pwrite which continues on meaningless errors (EINTR) but stops on
larger errors.
--
       Scott

Reply via email to