From c2f0aded1f86373335282c2a53b4ab09c6cfab2c Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Thu, 5 Dec 2024 17:16:06 -0800 Subject: [PATCH] Move the xp_lockfile() into a compile block that includes Borland --- src/xpdev/filewrap.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c index da2c5713e9..f0bb30adae 100644 --- a/src/xpdev/filewrap.c +++ b/src/xpdev/filewrap.c @@ -249,22 +249,6 @@ int sopen(const char *fn, int sh_access, int share, ...) #define LK_UNLCK LK_UNLOCK #endif -int xp_lockfile(int file, off_t offset, off_t size, bool block) -{ - int i; - off_t pos; - - pos=tell(file); - if(offset!=pos) - (void)lseek(file, offset, SEEK_SET); - do { - 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); -} - int unlock(int file, off_t offset, off_t size) { int i; @@ -426,3 +410,22 @@ FILE *_fsopen(const char *pszFilename, const char *pszMode, int shmode) #endif } #endif + +#ifdef _WIN32 +int xp_lockfile(int file, off_t offset, off_t size, bool block) +{ + int i; + off_t pos; + + pos=tell(file); + if(offset!=pos) + (void)lseek(file, offset, SEEK_SET); + do { + 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 + -- GitLab