aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/advanced.source
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-12-11 11:51:56 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-12-11 11:51:56 -0500
commit07ce2432682d1b2d593d15283fe66e88cb27285e (patch)
tree3b73a00342c44bea0b20260e9f640e20baba371d /src/tutorial/advanced.source
parent3f86867d560fbcdc717ad301c1a7142992f311c2 (diff)
downloadpostgresql-07ce2432682d1b2d593d15283fe66e88cb27285e.tar.gz
postgresql-07ce2432682d1b2d593d15283fe66e88cb27285e.zip
Be more wary about OpenSSL not setting errno on error.
OpenSSL will sometimes return SSL_ERROR_SYSCALL without having set errno; this is apparently a reflection of recv(2)'s habit of not setting errno when reporting EOF. Ensure that we treat such cases the same as read EOF. Previously, we'd frequently report them like "could not accept SSL connection: Success" which is confusing, or worse report them with an unrelated errno left over from some previous syscall. To fix, ensure that errno is zeroed immediately before the call, and report its value only when it's not zero afterwards; otherwise report EOF. For consistency, I've applied the same coding pattern in libpq's pqsecure_raw_read(). Bare recv(2) shouldn't really return -1 without setting errno, but in case it does we might as well cope. Per report from Andres Freund. Back-patch to all supported versions. Discussion: https://postgr.es/m/20231208181451.deqnflwxqoehhxpe@awork3.anarazel.de
Diffstat (limited to 'src/tutorial/advanced.source')
0 files changed, 0 insertions, 0 deletions