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.
REL8_1_STABLE
Tom Lane 20 years ago
parent d156e1f850
commit b888ab82da
  1. 19
      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;
}

Loading…
Cancel
Save