/*
- * $Id: file.c,v 1.79 2003-01-26 10:42:40 didg Exp $
+ * $Id: file.c,v 1.80 2003-01-30 17:32:46 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
{
struct adouble ad;
int adflags, err = AFP_OK;
- int locktype = ADLOCK_WR;
int openmode = O_RDWR;
#ifdef DEBUG
case EACCES:
if(openmode == O_RDWR) {
openmode = O_RDONLY;
- locktype = ADLOCK_RD;
continue;
} else {
return AFPERR_ACCESS;
case EACCES:
if(openmode == O_RDWR) {
openmode = O_RDONLY;
- locktype = ADLOCK_RD;
continue;
} else {
return AFPERR_ACCESS;
*
* FIXME it doesn't for RFORK open read only and fork open without deny mode
*/
- if (ad_tmplock(&ad, ADEID_RFORK, locktype |ADLOCK_FILELOCK, 0, 0, 0) < 0 ) {
+ if (ad_tmplock(&ad, ADEID_RFORK, ADLOCK_WR |ADLOCK_FILELOCK, 0, 0, 0) < 0 ) {
ad_close( &ad, adflags );
return( AFPERR_BUSY );
}
}
- if (ad_tmplock( &ad, ADEID_DFORK, locktype, 0, 0, 0 ) < 0) {
+ if (ad_tmplock( &ad, ADEID_DFORK, ADLOCK_WR, 0, 0, 0 ) < 0) {
err = AFPERR_BUSY;
}
else if ( 0 == (err = netatalk_unlink( ad_path( file, ADFLAGS_HF )) )) {
/*
- * $Id: ad_lock.c,v 1.8 2003-01-16 21:18:15 didg Exp $
+ * $Id: ad_lock.c,v 1.9 2003-01-30 17:32:45 didg Exp $
*
* Copyright (c) 1998,1999 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT for more information.
if (!(type & ADLOCK_FILELOCK))
lock.l_start += ad_getentryoff(ad, eid);
}
+
+ if (!(adf->adf_flags & O_RDWR) && (type & ADLOCK_WR)) {
+ type = (type & ~ADLOCK_WR) | ADLOCK_RD;
+ }
+
lock.l_type = XLATE_FCNTL_LOCK(type & ADLOCK_MASK);
lock.l_whence = SEEK_SET;
lock.l_len = len;