From 35736874f97dcb72246858f641faa60d9bab57c8 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Fri, 30 Nov 2007 11:16:43 +0000 Subject: [PATCH] Use _dosmaperr() to deal with errors opening files in pgwin32_open(). Per complaint from Alvaro and subsequent discussion. --- src/port/open.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/port/open.c b/src/port/open.c index 1d8778b73b..526897d168 100644 --- a/src/port/open.c +++ b/src/port/open.c @@ -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; } -- 2.40.0