]> granicus.if.org Git - postgresql/commit
Fix potentially-unportable code in contrib/adminpack.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 15 Apr 2018 17:02:11 +0000 (13:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 15 Apr 2018 17:02:11 +0000 (13:02 -0400)
commit16d3dbe2f30ab40a78873029d33aeed2765fa0d0
tree32aa4a31471a841a151bd79aec4e324ebd5d02c6
parentd014b38df60fe7f486bfaeb9b55a4851bf32c86f
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.)
contrib/adminpack/adminpack.c