Subject: Re: write() returning -1 and EINTR?
To: <>
From: David Laight <>
List: netbsd-users
Date: 12/17/2002 10:35:09
> My "POSIX Programmer's Guide" reads:
>    Synopsis:
> 	#include <unistd.h>
> 	int write(int fildes, const void *buf, unsigned int nbyte)
>         ...
> 	If a 'write' is interrupted by a signal, it will either return
> 	-1 with 'errno' set to 'EINTR" or it will return a the non-zero
> 	number of bytes written.  A 'write' to a pipe will never return
> 	'EINTR' if it has transferred any data and 'nybyte' is less than
> 	'PIPE_BUF".

You need to get a newer book :-)

    If write() is interrupted by a signal before it writes any data,
    it shall return -1 with errno set to [EINTR].

    If write() is interrupted by a signal after it successfully
    writes some data, it shall return the number of bytes written.


David Laight: