From ad53cdc7d0008492a6856be36958ce704ed71d56 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 28 Apr 2003 02:29:49 +0000 Subject: [PATCH] More work in the lock()/unlock() functions. In QNX, flock() is a fcntl() wrapper... so just use fcntl() locks. Also, if it is flat out impossible for anyone to ever get a lock on a particular file (ie: is a socket) do not fail. --- src/xpdev/filewrap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c index f8819de33f..2fbc927a9b 100644 --- a/src/xpdev/filewrap.c +++ b/src/xpdev/filewrap.c @@ -107,13 +107,13 @@ int DLLCALL lock(int fd, long pos, int len) alock.l_start = pos; alock.l_len = (int)len; - if(fcntl(fd, F_SETLK, &alock)==-1) + if(fcntl(fd, F_SETLK, &alock)==-1 && errno != EINVAL) return(-1); #endif - #if !defined(F_SANEWRLCKNO) + #if !defined(F_SANEWRLCKNO) && !defined(__QNX__) /* use flock (doesn't work over NFS) */ - if(flock(fd,LOCK_EX|LOCK_NB)!=0) + if(flock(fd,LOCK_EX|LOCK_NB)!=0 && errno != EOPNOTSUPP) return(-1); #endif @@ -138,13 +138,13 @@ int DLLCALL unlock(int fd, long pos, int len) alock.l_whence = L_SET; alock.l_start = pos; alock.l_len = (int)len; - if(fcntl(fd, F_SETLK, &alock)==-1) + if(fcntl(fd, F_SETLK, &alock)==-1 && errno != EINVAL) return(-1); #endif -#if !defined(F_SANEUNLCK) +#if !defined(F_SANEUNLCK) && !defined(__QNX__) /* use flock (doesn't work over NFS) */ - if(flock(fd,LOCK_UN|LOCK_NB)!=0) + if(flock(fd,LOCK_UN|LOCK_NB)!=0 && errno != EOPNOTSUPP) return(-1); #endif -- GitLab