Re: [patch]Modify the example code in write(2) manual

2018-09-26 Thread Nan Xiao
Hi Ingo, Thanks very much for your time and detailed explanation! I have one more question: If write(2) indeed returns 0, the write(2) won't set errno variable, ring? Because from the manual, the errno is set only when the return value is -1. If this is true, the errno's value should be set by

Re: [patch]Modify the example code in write(2) manual

2018-09-26 Thread Ingo Schwarze
Hi, Nan Xiao wrote on Wed, Sep 26, 2018 at 09:42:02PM +0800: > Any developer can comment on this patch? Thanks! I think this change is a bad idea and should not be committed. No matter whether or not it can happen on OpenBSD, *if* some implementation of write(2) sometimes returns 0 even for

Re: [patch]Modify the example code in write(2) manual

2018-09-26 Thread Nan Xiao
ping tech@, Any developer can comment on this patch? Thanks! On 9/25/2018 10:10 PM, Nan Xiao wrote: > Hi tech@, > > I am reading write(2) manual, and come across the following example: > > for (off = 0; off < bsz; off += nw) > if ((nw = write(d, buf + off, bsz - off)) == 0 || nw == -1) >

[patch]Modify the example code in write(2) manual

2018-09-25 Thread Nan Xiao
Hi tech@, I am reading write(2) manual, and come across the following example: for (off = 0; off < bsz; off += nw) if ((nw = write(d, buf + off, bsz - off)) == 0 || nw == -1) err(1, "write"); I am just wondering when the write(2) will return 0? If in some cases, it will