On Mon, 18 Sep 2017 16:50:41 +0200, Ingo Schwarze wrote: > Indeed, the above code is nonsensical. > It will write the same bytes repeatedly in case of partial writes.
OK millert@ That does look much better, though I'm not convinced that write(2) will ever return 0 unless nbytes is also 0. POSIX doesn't disallow this so I suppose we must assume it could happen. However, if it did, in your example err() will use some an old errno value. I don't think this is actually possible so it is not worth cluttering up the error reporting in the example. - todd
