mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Use _dosmaperr() to deal with errors opening files in pgwin32_open().
Per complaint from Alvaro and subsequent discussion.
This commit is contained in:
parent
c2d30556a1
commit
35736874f9
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.21 2007/11/15 21:14:46 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.22 2007/11/30 11:16:43 mha Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -88,22 +88,7 @@ pgwin32_open(const char *fileName, int fileFlags,...)
|
||||
((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;
|
||||
}
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user