From 25e4199a44277a9eac5f04637540d095831de014 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Wed, 28 Sep 2022 05:35:10 +0000
Subject: [PATCH v2] Extend win32 error codes to errno mapping in win32error.c

The doserrors[] table in win32error.c maps win32 error codes to
errno so that the errors get handled uniformly by the callers
across postgres code in a platform-independent way. The mapping
table has covered the most common win32 errors, however, it
missed ERROR_INVALID_NAME which gets emitted when the file name,
directory name, or volume label syntax is incorrect. This error
on win32 platforms is easy to hit - for instance, sending a
malformed file name to open() system call.

The closest mapping for ERROR_INVALID_NAME is ENOENT, this commit
adds it to the doserrors[] mapping table.

Reviewed-by: Michael Paquier
Author: Bharath Rupireddy
Discussion: https://www.postgresql.org/message-id/flat/CALj2ACWet-b8Juba0DiXwfGCyyOcohzwksahE5ebB9rcbLZKCQ%40mail.gmail.com
---
 src/port/win32error.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/port/win32error.c b/src/port/win32error.c
index fca867ba3d..a78d323827 100644
--- a/src/port/win32error.c
+++ b/src/port/win32error.c
@@ -164,6 +164,9 @@ static const struct
 	},
 	{
 		ERROR_DELETE_PENDING, ENOENT
+	},
+	{
+		ERROR_INVALID_NAME, ENOENT
 	}
 };
 
-- 
2.34.1

