reorderbuffer: preserve errno while reporting error

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: ac3aac3292d6e958bb8235120ba6a12159a29afe
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2016-08-19T17:38:55Z
Releases: 9.5.5
reorderbuffer: preserve errno while reporting error

Clobbering errno during cleanup after an error is an oft-repeated, easy
to make mistake.  Deal with it here as everywhere else, by saving it
aside and restoring after cleanup, before ereport'ing.

In passing, add a missing errcode declaration in another ereport() call
in the same file, which I noticed while skimming the file looking for
similar problems.

Backpatch to 9.4, where this code was introduced.

Files

PathChange+/−
src/backend/replication/logical/reorderbuffer.c modified +5 −1