mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03: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
061f80e371
commit
0e6ec4b471
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.17 2006/10/04 00:30:14 momjian Exp $
|
* $PostgreSQL: pgsql/src/port/open.c,v 1.17.2.1 2007/11/30 11:16:46 mha Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -85,22 +85,7 @@ pgwin32_open(const char *fileName, int fileFlags,...)
|
|||||||
((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
|
((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
|
||||||
NULL)) == INVALID_HANDLE_VALUE)
|
NULL)) == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
switch (GetLastError())
|
_dosmaperr(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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user