On Fri, Nov 22, 2013 at 10:04:02PM +0100, Maxime Villard wrote:

> Le 22/11/2013 17:48, Ted Unangst a ??crit :
> > On Fri, Nov 22, 2013 at 10:09, Stuart Henderson wrote:
> >> On 2013/11/22 07:25, Maxime Villard wrote:
> > 
> >>> If write() fails without EPIPE, d is decremented, and the function
> >>> keeps looping. If write() succeeds after several loops, d will be
> >>> negative, and the function will write from buf-XX.
> > 
> > When does write() fail and do we want to keep writing? (If I fill up
> > the filesystem, do I really want to spin here?)
> 
> 
> I must say that I actually fail to see why EPIPE is the only case
> handled; it should stop looping regardless of the errno code,
> shouldn't it?

often you'll ned to retry on EAGAIN. But indeed, the code is weird.

> 
> 
> > 
> >> Shouldn't it be something more like this? Otherwise if the write() fails,
> >> we attempt writing one byte fewer for every retry.
> > 
> > That looks better to me.
> > 

Reply via email to