Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3573687

Browse files
committed
Use _dosmaperr() to deal with errors opening files in pgwin32_open().
Per complaint from Alvaro and subsequent discussion.
1 parent c2d3055 commit 3573687

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/port/open.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/port/open.c,v 1.21 2007/11/15 21:14:46 momjian Exp $
9+
* $PostgreSQL: pgsql/src/port/open.c,v 1.22 2007/11/30 11:16:43 mha Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -88,22 +88,7 @@ pgwin32_open(const char *fileName, int fileFlags,...)
8888
((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
8989
NULL)) == INVALID_HANDLE_VALUE)
9090
{
91-
switch (GetLastError())
92-
{
93-
/* EMFILE, ENFILE should not occur from CreateFile. */
94-
case ERROR_PATH_NOT_FOUND:
95-
case ERROR_FILE_NOT_FOUND:
96-
errno = ENOENT;
97-
break;
98-
case ERROR_FILE_EXISTS:
99-
errno = EEXIST;
100-
break;
101-
case ERROR_ACCESS_DENIED:
102-
errno = EACCES;
103-
break;
104-
default:
105-
errno = EINVAL;
106-
}
91+
_dosmaperr(GetLastError());
10792
return -1;
10893
}
10994

0 commit comments

Comments
 (0)