On Wed, Nov 28, 2007 at 05:20:46PM +0100, Magnus Hagander wrote:
> On Wed, Nov 28, 2007 at 12:24:26PM -0300, Alvaro Herrera wrote:
> > Martijn van Oosterhout wrote:
> > > On Wed, Nov 28, 2007 at 11:57:35AM -0300, Alvaro Herrera wrote:
> > > > Can we do something like this to report the Win32 error code so that the
> > > > user has a higher chance of figuring out what's going on?
>
> We already do something very similar to what you're donig in
> backend/port/wni32/socket.c :: TranslateSocketError().
>
> So I think it's a good idea to do it, yes.
Thinking about this some more, I think this is a better patch - we already
have a function that takes care of this, including both error and debug
logging. Anybody disagree? If not, I'll go ahead and apply it...
//Magnus
Index: src/port/open.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/open.c,v
retrieving revision 1.21
diff -c -r1.21 open.c
*** src/port/open.c 15 Nov 2007 21:14:46 -0000 1.21
--- src/port/open.c 29 Nov 2007 11:44:46 -0000
***************
*** 88,109 ****
((fileFlags & O_DSYNC) ?
FILE_FLAG_WRITE_THROUGH : 0),
NULL)) == INVALID_HANDLE_VALUE)
{
! switch (GetLastError())
! {
! /* EMFILE, ENFILE should not occur from
CreateFile. */
! case ERROR_PATH_NOT_FOUND:
! case ERROR_FILE_NOT_FOUND:
! errno = ENOENT;
! break;
! case ERROR_FILE_EXISTS:
! errno = EEXIST;
! break;
! case ERROR_ACCESS_DENIED:
! errno = EACCES;
! break;
! default:
! errno = EINVAL;
! }
return -1;
}
--- 88,94 ----
((fileFlags & O_DSYNC) ?
FILE_FLAG_WRITE_THROUGH : 0),
NULL)) == INVALID_HANDLE_VALUE)
{
! _dosmaperr(GetLastError());
return -1;
}
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly