diff options
author | Markus Armbruster <armbru@redhat.com> | 2023-09-28 15:19:50 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-10-11 11:17:03 +0200 |
commit | 07249822212ec56484ecfb5594d2ec94c84961fa (patch) | |
tree | d0b5cc72a1e870af44eb070dd15080c477a7915b /python | |
parent | 0110c6b86a828c9c2f42fbed4fc0da30ad7bf6eb (diff) | |
download | qemu-07249822212ec56484ecfb5594d2ec94c84961fa.zip qemu-07249822212ec56484ecfb5594d2ec94c84961fa.tar.gz qemu-07249822212ec56484ecfb5594d2ec94c84961fa.tar.bz2 |
migration/rdma: Fix rdma_getaddrinfo() error checking
rdma_getaddrinfo() returns 0 on success. On error, it returns one of
the EAI_ error codes like getaddrinfo() does, or -1 with errno set.
This is broken by design: POSIX implicitly specifies the EAI_ error
codes to be non-zero, no more. They could clash with -1. Nothing we
can do about this design flaw.
Both callers of rdma_getaddrinfo() only recognize negative values as
error. Works only because systems elect to make the EAI_ error codes
negative.
Best not to rely on that: change the callers to treat any non-zero
value as failure. Also change them to return -1 instead of the value
received from getaddrinfo() on failure, to avoid positive error
values.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230928132019.2544702-25-armbru@redhat.com>
Diffstat (limited to 'python')
0 files changed, 0 insertions, 0 deletions