Re: Re: [HACKERS] Re: WIN32 errno patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Mikhail Terekhov <terekhov(at)emc(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Re: [HACKERS] Re: WIN32 errno patch
Date: 2001-08-17 15:38:09
Message-ID: 29834.998062689@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> I will try to apply it within the next 48 hours.

This isn't the right patch to apply, since Mikhail didn't fix the
strerror problem. I have some code from Magnus Naeslund that purports
to handle the strerror issue, and will work it up into a patch real soon
now.

>> I've implemented the SOCK_ERRNO macro only because
>> both strerror and FormatMessage functions know nothing
>> about sockets errors.

FWIW, Magnus says this works:

#define SOCK_STRERROR my_sock_strerror

const char* my_sock_strerror(unsigned long eno){
static char buf[512]; // i know, not threadsafe
if (!FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
0,eno,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buf,sizeof(buf)-1,
0
)){
sprintf(buf,"Unknown socket error(%u)",eno);
}
buf[sizeof(buf)-1]='\0';
return buf;
}

Anyone have any objections to it?

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2001-08-17 15:38:58 Re: Re: [HACKERS] Re: WIN32 errno patch
Previous Message Bruce Momjian - CVS 2001-08-17 15:11:15 pgsql/src/interfaces/libpq fe-auth.c fe-connec ...

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-08-17 15:38:58 Re: Re: [HACKERS] Re: WIN32 errno patch
Previous Message Bruce Momjian 2001-08-17 15:34:29 Re: Dollar in identifiers

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-08-17 15:38:58 Re: Re: [HACKERS] Re: WIN32 errno patch
Previous Message Bruce Momjian 2001-08-17 15:02:52 Added \n to libpq prints