diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-07-06 08:02:24 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-07-06 08:10:55 +0200 |
commit | 27aec5911a8fd00068c6db8f1a73d61903488b0c (patch) | |
tree | cd416c68d041032eea9c6b99cc1437d1a6081b79 /test | |
parent | cbac0245c8fd94ce66c05b1abe05bfa0d6dda251 (diff) | |
download | passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar.gz passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar.bz2 passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar.lz passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar.xz passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.tar.zst passt-27aec5911a8fd00068c6db8f1a73d61903488b0c.zip |
qrap: Don't rely on errno after perror(), and reset it before usage
In commit fca5e11773d0 ("qrap: Add probe retry on connection reset
from passt for KubeVirt integration") I just used errno to check if
the connection was reset on recv(), but perror() might set it to
EINVAL if e.g. an underlying logging mechanism fails, so we won't
actually catch the connection reset.
And in case recv() returns 0, errno won't be set, but we're still
using it without resetting it first, which leads to unpredictable
results in that case.
Reset errno before probing with connect(), send() and recv(), and
save it for later checks before calling perror().
Fixes: fca5e11773d0 ("qrap: Add probe retry on connection reset from passt for KubeVirt integration")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions