r14703: Clarify the return codes for the POSIX locking case. This
authorJeremy Allison <jra@samba.org>
Sat, 25 Mar 2006 01:35:43 +0000 (01:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:44 +0000 (11:15 -0500)
was confusing.
Jeremy.

source/lib/util.c
source/locking/posix.c

index 121beeecc04392be83a8798dcca95c4bcf87963a..45be357be4fb4a68ee419305a25cc06f088f12ad 100644 (file)
@@ -1873,7 +1873,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
        if (ret == -1 && errno != 0)
                DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
 
-       /* a lock query */
+       /* a lock query - return True if this region is locked, False if not locked. */
        if (op == SMB_F_GETLK) {
                if ((ret != -1) &&
                                (lock.l_type != F_UNLCK) && 
index 4b69047a3c445054be172a28d32786f6386ecdad..07246474f3f5dcd8006bd84c3ee3315f88728e1d 100644 (file)
@@ -644,15 +644,19 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
 
 /****************************************************************************
  Actual function that does POSIX locks. Copes with 64 -> 32 bit cruft and
- broken NFS implementations.
+ broken NFS implementations. Returns True if we got the lock or the region
+ is unlocked in the F_GETLK case, False otherwise.
 ****************************************************************************/
 
 static BOOL posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       int ret;
+       BOOL ret;
 
        DEBUG(8,("posix_fcntl_lock %d %d %.0f %.0f %d\n",fsp->fh->fd,op,(double)offset,(double)count,type));
 
+       /* In the F_GETLK case this returns True if the region 
+          was locked, False if unlocked. */
+
        ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type);
 
        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {