On 5/23/22 08:35, Richard Henderson wrote:
That implies that our current code is right, in that the
way to check for "did the call fail" is to look at the
retcode, not the errno (in the same way that if you make a
native syscall or library call you look first at its return
value, not at errno). There's nothing in the protocol text
that makes a guarantee that the errno value is non-0 if and
only if the call failed.
I admit that I didn't check the gdb code. I looked at our side and saw that when the
second result is missing that we'd supply 0, and interpreted "can be omitted" as "will be
omitted" on success.
Checking, can->will is actually correct, and gdb will omit the errno parameter
on success.
https://sourceware.org/git?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=fe191fb6069a53a3844656a81e77069afa781946;hb=HEAD#l328
So I think checking err != 0 is a good change.
r~