FileLock.java (isValid): locks are valid if the channel is open.
authorCasey Marshall <csm@gnu.org>
Fri, 12 Nov 2004 19:15:27 +0000 (19:15 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 12 Nov 2004 19:15:27 +0000 (19:15 +0000)
2004-11-11  Casey Marshall  <csm@gnu.org>

* gnu/java/nio/FileLock.java (isValid): locks are valid if the
channel is open.
* gnu/java/nio/channels/natFileChannelPosix.cc (lock): use
'F_RDLCK' for shared locks, 'F_WRLCK' for exclusive locks.

From-SVN: r90538

libjava/ChangeLog
libjava/gnu/java/nio/FileLockImpl.java
libjava/gnu/java/nio/channels/natFileChannelPosix.cc

index 98d7e4eb897a6bb46297e66a7720af59fbf27bce..6d130ff2d62cbf52958fc41acfc6bb423ccacd53 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-11  Casey Marshall  <csm@gnu.org>
+
+       * gnu/java/nio/FileLock.java (isValid): locks are valid if the
+       channel is open.
+       * gnu/java/nio/channels/natFileChannelPosix.cc (lock): use
+       'F_RDLCK' for shared locks, 'F_WRLCK' for exclusive locks.
+
 2004-11-11  Robert Schuster <thebohemian@gmx.net>
   
        Fixed regression:
index bba5880e22ce6aec6fd7874f7accf867d5a1b586..8591dac43b8be617fc54e33f913ed50dfee95195 100644 (file)
@@ -72,7 +72,7 @@ public class FileLockImpl extends FileLock
   
   public boolean isValid ()
   {
-    return !channel().isOpen();
+    return channel().isOpen();
   }
 
   public synchronized void release () throws IOException
index edc843b903af7257e98cc325287a8ff80b632648..742201bde94c15a22f0e99a0f1c1362a4951a31a 100644 (file)
@@ -457,7 +457,7 @@ FileChannelImpl::lock
 {
   struct flock lockdata;
 
-  lockdata.l_type = shared ? F_WRLCK : F_RDLCK;
+  lockdata.l_type = shared ? F_RDLCK : F_WRLCK;
   lockdata.l_whence = SEEK_SET;
   lockdata.l_start = pos;
   lockdata.l_len = len;