pgsql: Fix potentially-unportable code in contrib/adminpack. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix potentially-unportable code in contrib/adminpack.
Date
Msg-id E1f7l2u-000456-3M@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix potentially-unportable code in contrib/adminpack.

Spelling access(2)'s second argument as "2" is just horrid.
POSIX makes no promises as to the numeric values of W_OK and related
macros.  Even if it accidentally works as intended on every supported
platform, it's still unreadable and inconsistent with adjacent code.

In passing, don't spell "NULL" as "0" either.  Yes, that's legal C;
no, it's not project style.

Back-patch, just in case the unportability is real and not theoretical.
(Most likely, even if a platform had different bit assignments for
access()'s modes, there'd not be an observable behavior difference
here; but I'm being paranoid today.)

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3a2d6365984d2cd98ee03467cd901785941cf772

Modified Files
--------------
contrib/adminpack/adminpack.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Clean up callers of JsonbIteratorNext().
Next
From: Tom Lane
Date:
Subject: pgsql: Add temporary debugging assertion, in 9.4 branch only.