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. There is also a suitable function in gnulib with a similar purpose. I think it's called something like safe_write(). James. -- 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