On Tue, Apr 15, 2008 at 12:34:08PM +0100, James Youngman wrote: > On Mon, Apr 14, 2008 at 11:41 PM, Karel Zak <kzak@xxxxxxxxxx> wrote: > > +write_all(int fd, const void *buf, size_t count) { > > + while(count) { > > + ssize_t tmp = write(fd, buf, count); > > + > > + if (tmp > 0) { > > + count -= tmp; > > + if (count) > > + buf += tmp; > > > > + } else if (errno != EINTR && errno != EAGAIN) > > + return -1; > > + } > > + return 0; > > You may want to set errno to 0 immediately before the write call. Well, it makes sense when write() returns zero, because when -1 is returned the errno is set appropriately. I have no clue when write() returns zero (if count != 0). Any idea? Karel -- Karel Zak <kzak@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html