/*
- * $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.
*
/* ----------------------- */
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;
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;
}
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) {