From: Tom Lane Date: Fri, 7 Oct 2005 16:34:48 +0000 (+0000) Subject: Recognize ERROR_SHARING_VIOLATION (translate to EACCES), increase log X-Git-Tag: REL8_1_0BETA3~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b888ab82dab90409fd262655b05407403544bbfb;p=thirdparty%2Fpostgresql.git Recognize ERROR_SHARING_VIOLATION (translate to EACCES), increase log level for unrecognized win32 error codes to LOG, and make messages conform to style guide. Per old suggestion from Qingqing Zhou, which seems to have gotten lost in the shuffle. --- diff --git a/src/backend/port/win32/error.c b/src/backend/port/win32/error.c index 426eecbf69b..c7f0a24f102 100644 --- a/src/backend/port/win32/error.c +++ b/src/backend/port/win32/error.c @@ -6,14 +6,14 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32/error.c,v 1.4 2004/12/31 22:00:37 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32/error.c,v 1.5 2005/10/07 16:34:48 tgl Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" -static struct +static const struct { DWORD winerr; int doserr; @@ -74,6 +74,9 @@ static struct { ERROR_LOCK_VIOLATION, EACCES }, + { + ERROR_SHARING_VIOLATION, EACCES + }, { ERROR_BAD_NETPATH, ENOENT }, @@ -168,21 +171,21 @@ _dosmaperr(unsigned long e) return; } - for (i = 0; i < sizeof(doserrors) / sizeof(doserrors[0]); i++) + for (i = 0; i < lengthof(doserrors); i++) { if (doserrors[i].winerr == e) { errno = doserrors[i].doserr; ereport(DEBUG5, - (errmsg_internal("Mapped win32 error code %i to %i", - (int) e, errno))); + (errmsg_internal("mapped win32 error code %lu to %d", + e, errno))); return; } } - ereport(DEBUG4, - (errmsg_internal("Unknown win32 error code: %i", - (int) e))); + ereport(LOG, + (errmsg_internal("unrecognized win32 error code: %lu", + e))); errno = EINVAL; return; }