return ret;
}
}
- if ( access == (OPENACC_WR | OPENACC_RD | OPENACC_DWR | OPENACC_DRD)) {
- return ad_excl_lock(adp, eid);
- }
+
return 0;
}
ret = AFPERR_NOOBJ;
if (access & OPENACC_WR) {
/* try opening in read-write mode */
- if (ad_open(ofork->of_ad, upath, adflags | ADFLAGS_RDWR) < 0) {
+ if (ad_open(ofork->of_ad, upath,
+ adflags | ADFLAGS_RDWR | ADFLAGS_SETSHRMD) < 0) {
switch ( errno ) {
case EROFS:
ret = AFPERR_VLOCK;
case ENOENT:
if (fork == OPENFORK_DATA) {
/* try to open only the data fork */
- if (ad_open(ofork->of_ad, upath, ADFLAGS_DF | ADFLAGS_RDWR) < 0) {
+ if (ad_open(ofork->of_ad, upath,
+ ADFLAGS_DF | ADFLAGS_RDWR | ADFLAGS_SETSHRMD) < 0) {
goto openfork_err;
}
adflags = ADFLAGS_DF;
} else {
/* here's the deal. we only try to create the resource
* fork if the user wants to open it for write acess. */
- if (ad_open(ofork->of_ad, upath, adflags | ADFLAGS_RDWR | ADFLAGS_CREATE, 0666) < 0)
+ if (ad_open(ofork->of_ad, upath,
+ adflags | ADFLAGS_RDWR | ADFLAGS_SETSHRMD | ADFLAGS_CREATE, 0666) < 0)
goto openfork_err;
ofork->of_flags |= AFPFORK_OPEN;
}
} else {
/* try opening in read-only mode */
ret = AFPERR_NOOBJ;
- if (ad_open(ofork->of_ad, upath, adflags | ADFLAGS_RDONLY) < 0) {
+ /* we need w access for setting deny mode fcntl excl lock */
+ if (ad_open(ofork->of_ad, upath, adflags | ADFLAGS_RDONLY | ADFLAGS_SETSHRMD) < 0) {
switch ( errno ) {
case EROFS:
ret = AFPERR_VLOCK;
+ goto openfork_err;
case EACCES:
goto openfork_err;
- break;
case ENOENT:
/* see if client asked for a read only data fork */
if (fork == OPENFORK_DATA) {
- if (ad_open(ofork->of_ad, upath, ADFLAGS_DF | ADFLAGS_RDONLY) < 0) {
+ if (ad_open(ofork->of_ad, upath, ADFLAGS_DF | ADFLAGS_RDONLY | ADFLAGS_SETSHRMD) < 0) {
goto openfork_err;
}
adflags = ADFLAGS_DF;
*/
/* don't try to lock non-existent rforks. */
- if ((eid == ADEID_DFORK) || (ad_meta_fileno(ofork->of_ad) != -1)) { /* META */
+ if ((eid == ADEID_DFORK)
+ || (ad_meta_fileno(ofork->of_ad) != -1)
+ || (vol->v_adouble & AD_VERSION_EA)) { /* META */
ret = fork_setmode(ofork->of_ad, eid, access, ofrefnum);
/* can we access the fork? */