Re: REPOST: InitDB Failure on install
От | Magnus Hagander |
---|---|
Тема | Re: REPOST: InitDB Failure on install |
Дата | |
Msg-id | 6BCB9D8A16AC4241919521715F4D8BCE4569CA@algol.sollentuna.se обсуждение исходный текст |
Ответы |
Re: REPOST: InitDB Failure on install
Re: REPOST: InitDB Failure on install |
Список | pgsql-hackers-win32 |
>>>> (BTW, there was some discussion around this point while >you were gone. >>>> Dunno if you've caught up on the list traffic yet.) > >> Ok. I think I'm caught up now, and I don't find anything directly >> related to this. Could be because there was so much mail >that I skimmed >> some of it a bit too quickly... Could you provide me with a pointer? > >It took some digging, but here is the thread I had in mind: >http://archives.postgresql.org/pgsql-hackers-win32/2004-08/msg00047.php >http://archives.postgresql.org/pgsql-hackers-win32/2004-08/msg00050.php > >Life does get simpler if we can just do "errno = GetLastError()" but >I strongly suspect we're gonna end up wanting to do some mapping. Arrgh. I did see that one, just didn't connect. I guess the brain gets mushy after about 2500 mails.. Sorry about that one. Looking around a bit on the net, I see tons and tons of examples of people just doing the "errno=GetLastError()" codepath. And I find no evidence anywhere that this should not be safe. For winsock, look at for example http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock /winsock/error_codes_errno_h_errno_and_wsagetlasterror_2.asp which states "For compatibility with BSD, an application may choose to include a line of the form: #define errno WSAGetLastError". And WSAGetLastError() is equivalent to GetLastError() in any windows these days. Based on this, I think we're quite safe doing errno=GetLastError() in any places where we need it. What we might need to do is change the useful_strerror() function to use the FormatMessage function for all messages on win32, and not as now is done just for winsock functions. I'm not 100% sure this is needed - it's possible it handles all the standard messages and just not winsock. But it should not report *incorrect* error messages, it would just not know the text for the error message. In order to be future safe we ight want to do something like put a macro in win32.h doing #define Win32ErrorToErrno(i) i and then use errno=Win32ErrorToErrno(GetLastError()) In case we ever need a mapping, we can just change that macro into a function call, without needing to revisit all the code. Not sure if it's worth it, though? //Magnus
В списке pgsql-hackers-win32 по дате отправления: