WIN32 errno patch - Mailing list pgsql-hackers

From Tom Lane
Subject WIN32 errno patch
Date
Msg-id 21086.995748354@sss.pgh.pa.us
Whole thread Raw
Responses Re: WIN32 errno patch
List pgsql-hackers
Upon review, I don't think these patches are very good at all.
#defining errno as WSAGetLastError() is a fairly blunt instrument,
and it breaks all the places that do actually need to use errno,
such as PQoidValue, lo_import, lo_export.  I'm also concerned that
PQrequestCancel may need to save/restore both errno and
WSAGetLastError() in order to be safe for use in a signal handler.

Is errno a plain variable on WIN32, or is it a macro?  If the former,
we could hack around this problem by doing
#if WIN32#undef errno#endif
...
#if WIN32#define errno WSAGetLastError()#endif

around the routines that need to access the real errno.  While ugly,
this probably beats the alternative of ifdef'ing all the places that
do need to access the WSA error code.
        regards, tom lane


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: sub queries and caching.
Next
From: Bruce Momjian
Date:
Subject: Re: WIN32 errno patch