From fc17319e92c4b7af30123d5761038fd9b92711f9 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on ChromeOS)" <rob@synchro.net>
Date: Thu, 5 Dec 2024 17:51:50 -0800
Subject: [PATCH] Appears MinGW requires '_locking' Borland requires 'locking'
 and MSVC does both

---
 src/xpdev/filewrap.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c
index 09034a9b22..70454cf84b 100644
--- a/src/xpdev/filewrap.c
+++ b/src/xpdev/filewrap.c
@@ -257,7 +257,7 @@ int unlock(int file, off_t offset, off_t size)
 	pos=tell(file);
 	if(offset!=pos)
 		(void)lseek(file, offset, SEEK_SET);
-	i = locking(file,LK_UNLCK,(long)size);
+	i = _locking(file,LK_UNLCK,(long)size);
 	if(offset!=pos)
 		(void)lseek(file, pos, SEEK_SET);
 	return(i);
@@ -413,6 +413,9 @@ FILE *_fsopen(const char *pszFilename, const char *pszMode, int shmode)
 
 #ifdef _WIN32
 #include <sys/locking.h>	/* LK_LOCK */
+#if defined __BORLANDC__
+	#define _locking locking
+#endif
 int xp_lockfile(int file, off_t offset, off_t size, bool block)
 {
 	int	i;
@@ -422,11 +425,11 @@ int xp_lockfile(int file, off_t offset, off_t size, bool block)
 	if(offset!=pos)
 		(void)lseek(file, offset, SEEK_SET);
 	do {
-		i = locking(file, block ? LK_LOCK : LK_NBLCK, (long)size);
+		i = _locking(file, block ? LK_LOCK : LK_NBLCK, (long)size);
 	} while(block && i != 0 && errno == EDEADLOCK);
 	if(offset!=pos)
 		(void)lseek(file, pos, SEEK_SET);
 	return(i);
 }
-#endif
+#endif // _WIN32
 
-- 
GitLab