pgsql: In pg_log_generic(), be more paranoid about preserving errno.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: In pg_log_generic(), be more paranoid about preserving errno.
Date: 2019-07-06 15:26:01
Message-ID: E1hjmZd-00014Y-Gh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In pg_log_generic(), be more paranoid about preserving errno.

This code failed to account for the possibility that malloc() would
change errno, resulting in wrong output for %m, not to mention the
possibility of message truncation. Such a change is obviously
expected when malloc fails, but there's reason to fear that on some
platforms even a successful malloc call can modify errno.

Discussion: https://postgr.es/m/2576.1527382833@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fb30c9c1c5c36989d6b93906986358cb96936d64

Modified Files
--------------
src/common/logging.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-07-07 01:03:36 pgsql: Remove more unreferenced function declarations
Previous Message Peter Eisentraut 2019-07-06 13:04:26 pgsql: Add missing source files to nls.mk