RFC: Work around POSIX non-conformity of Microsoft's dup2() function

Keith Marshall <[email protected]> Fri, 25 Jun 2021 19:36:00 +0100
Newsgroups gmane.comp.gnu.mingw.user
Organization MinGW.org Project
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============5596227096351390597==
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="Y5wInFhsfZClh95LEG6CfvmvLTGs7hC47"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Y5wInFhsfZClh95LEG6CfvmvLTGs7hC47
Content-Type: multipart/mixed; boundary="mNZLg6vYlBfj8ATi6qeCkkKhprgC1eEkt";
 protected-headers="v1"
From: Keith Marshall <[email protected]>
Reply-To: keith.d.marshall-XZoyATsUNX5Wk0Htik3J/[email protected]
To: MinGW Users List <[email protected]>
Message-ID: <927e5be5-e2b1-4970-3b14-b6ab9d3a0db8-JlWs9+JhQMeJPt80KsDg5Q@public.gmane.org>
Subject: RFC: Work around POSIX non-conformity of Microsoft's dup2() function

--mNZLg6vYlBfj8ATi6qeCkkKhprgC1eEkt
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

The documentation describes it as a POSIX function, (in name at least,
and albeit deprecated for use with MSVC), but its behaviour definitely
does NOT conform to the POSIX.1 specification.

I've written a description of the issue, and proposed corrective action,
as ticket https://osdn.net/projects/mingw/ticket/42561

I would appreciate a review of my proposed changes, by the MinGW user
community.  In the absence of any objections, I plan to incorporate the
proposed (option 4) change into the next mingwrt release.

TIA.

--=20
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


--mNZLg6vYlBfj8ATi6qeCkkKhprgC1eEkt--

--Y5wInFhsfZClh95LEG6CfvmvLTGs7hC47
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAmDWIhAFAwAAAAAACgkQwK02xjR+Wj8Z
wBAAifQRHYLhyCkwxlnF3i345L+1o6/FTcQwyxzq6nrUEWYW40jiieWo83/jVK5PvBf3uZiPwoxN
VBrHug0DeJwYAwnyJbwZLlQiDbgCnrjFsEAIQIqS3Y5vfWHiDGXsTTEp7JxdhLLvt9O8X6Nl/BQe
h4qztwftaSU5zNhJrGSXncg3UyIQVaidCzLMJ9BwqKUP+3BrAKD+St3tVpiYnbVK8L97lrQBrPM8
jsxch8yeRaqhH//LRmDFCKT31EK1l7opdthw8z6zQZWlz2mEwgFNWm9eX/nf67pg6rldgrXvrGFf
TmvPBmjoFN09hqORQyEag5Kx3BcZt17iPU3nnxGdiMiJ3gLDXhjWWgXlt3HsvCD1wCyYjs1szNo9
2lXd/iq0Lb7NjUyzIh6erPJzPsVKjRXClz7FkCDSr9GX+rxjTjS89JhQc0MiWvUDAZ5/YhRbkKSs
MP9nfId3o5295D9uamwsBA4OBjisuUZq60tdGwgFKpX23odEAHrZfDf+seMDeET9yOWjNQRW1D9M
mK4+1QLWEBQNQtn3vEeG7WgoHfmwmNg1JF7aXNmf4kUaa4QZ9liN68mXLUDUbq8Uc6WpeBXPh9H/
U91xfuWD9Yik5EgZlKjODYl5mU/K7d7gJyKOxjoX3Lua0XVzZl9bOGhl2nEjXmr2hWkhhuEsgyxo
UOA=
=q4ZT
-----END PGP SIGNATURE-----

--Y5wInFhsfZClh95LEG6CfvmvLTGs7hC47--


--===============5596227096351390597==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTWluR1ctVXNl
cnMgbWFpbGluZyBsaXN0Ck1pbkdXLVVzZXJzQGxpc3RzLm9zZG4ubWUKClRoaXMgbGlzdCBvYnNl
cnZlcyB0aGUgUG9zdGluZyBFdGlxdWV0dGUsIGFzIGRlc2NyaWJlZCBhdCBodHRwczovL21pbmd3
Lm9zZG4uaW8vaW5kZXguaHRtbD9wYWdlPW1haWxpbmcuaHRtbCNsaXN0LWV0aXF1ZXR0ZS4KV2Ug
YXNrIHRoYXQgeW91IGJlIHBvbGl0ZSBhbmQgZG8gdGhlIHNhbWUuICBEaXNyZWdhcmQgZm9yIHRo
ZSBsaXN0IGV0aXF1ZXR0ZSBtYXkgY2F1c2UgeW91ciBhY2NvdW50IHRvIGJlIG1vZGVyYXRlZC4K
Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCllvdSBtYXkg
Y2hhbmdlIHlvdXIgTWluR1cgQWNjb3VudCBPcHRpb25zIG9yIHVuc3Vic2NyaWJlIGF0OgpodHRw
czovL2xpc3RzLm9zZG4ubWUvbWFpbG1hbi9saXN0aW5mby9taW5ndy11c2VycwpBbHNvOiBtYWls
dG86bWluZ3ctdXNlcnMtcmVxdWVzdEBsaXN0cy5vc2RuLm1lP3N1YmplY3Q9dW5zdWJzY3JpYmU=

--===============5596227096351390597==--