svn commit: samba r14703 - in branches/SAMBA_3_0/source: lib locking

jra at samba.org jra at samba.org
Sat Mar 25 01:35:45 GMT 2006


Author: jra
Date: 2006-03-25 01:35:43 +0000 (Sat, 25 Mar 2006)
New Revision: 14703

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14703

Log:
Clarify the return codes for the POSIX locking case. This
was confusing.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/util.c
   branches/SAMBA_3_0/source/locking/posix.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util.c	2006-03-25 01:02:10 UTC (rev 14702)
+++ branches/SAMBA_3_0/source/lib/util.c	2006-03-25 01:35:43 UTC (rev 14703)
@@ -1873,7 +1873,7 @@
 	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) && 

Modified: branches/SAMBA_3_0/source/locking/posix.c
===================================================================
--- branches/SAMBA_3_0/source/locking/posix.c	2006-03-25 01:02:10 UTC (rev 14702)
+++ branches/SAMBA_3_0/source/locking/posix.c	2006-03-25 01:35:43 UTC (rev 14703)
@@ -644,15 +644,19 @@
 
 /****************************************************************************
  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))) {



More information about the samba-cvs mailing list