On Wed, Apr 16, 2008 at 12:46:32AM +0200, Karel Zak wrote: > On Tue, Apr 15, 2008 at 12:34:08PM +0100, James Youngman wrote: > > 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? Some OSes return 0 on end of file. For full complete "posixness", errno should only be checked when the syscall returns -1, and never be cleared. In that case, a return of zero should terminate the write, and return how ever many bytes were written to that point. lamont -- 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