]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/adouble/ad_lock.c
Fix ad_open, ad_flush, ad_close, VFS stuff and volinfo for adouble:ea, also deactivat...
[netatalk.git] / libatalk / adouble / ad_lock.c
index fce2c2d02b77ee2e4ae6c5f07abe84c241417255..688ec4b9624ea439dbcc2a14ea1b08f787f161fd 100644 (file)
@@ -1,6 +1,4 @@
 /* 
- * $Id: ad_lock.c,v 1.19 2010-02-26 12:57:50 didg Exp $
- *
  * Copyright (c) 1998,1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved. See COPYRIGHT for more information.
  *
@@ -42,8 +40,8 @@
 /* ----------------------- */
 static int set_lock(int fd, int cmd,  struct flock *lock)
 {
-  if (!fd) {
-      /* We assign fd = 0 for symlinks -> do nothing */
+  if (fd == -2) {
+      /* We assign fd = -2 for symlinks -> do nothing */
       if (cmd == F_GETLK)
            lock->l_type = F_UNLCK;
       return 0;
@@ -338,12 +336,16 @@ int ad_fcntl_lock(struct adouble *ad, const u_int32_t eid, const int locktype,
      1) we're trying to re-lock a lock, but we didn't specify an update.
      2) we're trying to free only part of a lock. 
      3) we're trying to free a non-existent lock. */
-  if ((!adflock && (lock.l_type == F_UNLCK)) ||
-      (adflock && !(type & ADLOCK_UPGRADE) && 
-       ((lock.l_type != F_UNLCK) || (adflock->lock.l_start != lock.l_start) ||
-       (adflock->lock.l_len != lock.l_len)))) {
-    errno = EINVAL;
-    return -1;
+  if ( (!adflock && (lock.l_type == F_UNLCK))
+       ||
+       (adflock
+        && !(type & ADLOCK_UPGRADE)
+        && ((lock.l_type != F_UNLCK)
+            || (adflock->lock.l_start != lock.l_start)
+            || (adflock->lock.l_len != lock.l_len) ))
+      ) {
+      errno = EINVAL;
+      return -1;
   }
 
 
@@ -630,7 +632,7 @@ void ad_fcntl_unlock(struct adouble *ad, const int fork)
     adf_unlock(&ad->ad_resource_fork, fork);
   }
 
-  if (ad->ad_flags != AD_VERSION1_SFM) {
+  if (ad->ad_flags != AD_VERSION_EA) {
     return;
   }
   if (ad_meta_fileno(ad) != -1) {