[EXTERNAL] Re: scp stalls on uploading in cygwin 3.5 current master.
Lavrentiev, Anton (NIH/NLM/NCBI) [C]
Sat Aug 26 14:08:34 GMT 2023
> > Can we use send(sock, "", 0) to reenable FD_WRITE, perhaps?
> Your idea seems to work. The following patch looks to solve the issue.
> Is it supposed to be any side effect()?
IMO you're triggering an undefined (or not well-defined) behavior, because of the murky status
of the byte count of 0. It may work now, but it may not work in the future...
On success, the number of bytes written is returned (zero indicates nothing was written). On error, -1 is returned, and
errno is set appropriately.
If count is zero and fd refers to a regular file, then write() may return a failure status if one of the errors below is
detected. If no errors are detected, 0 will be returned without causing any other effect. If count is zero and fd refers
to a file other than a regular file, the results are not specified.
Think of the effects of "recv(sock, buf, 0)" along the lines: the only valid return values in this
case would be -1 and 0, whereas 0 [usually] means EOF, but would it be really meant in this case?
More information about the Cygwin