}
if (adp && ad_tmplock( &ad, ADEID_DFORK, ADLOCK_WR, 0, 0, 0 ) < 0) {
+ LOG(log_error, logtype_afpd, "deletefile('%s'): ad_tmplock error: %s", file, strerror(errno));
err = AFPERR_BUSY;
} else if (!(err = vol->vfs->vfs_deletefile(vol, dirfd, file)) && !(err = netatalk_unlinkat(dirfd, file )) ) {
cnid_t id;
extern char *ad_dir (const char *);
extern const char *ad_path (const char *, int);
extern const char *ad_path_ea (const char *, int);
+extern const char *ad_path_osx (const char *path, int adflags);
extern int ad_mode (const char *, mode_t);
extern int ad_mkdir (const char *, mode_t);
struct vol;
if (ad->ad_adflags & ADFLAGS_DIR) {
EC_NEG1_LOG( cwd = open(".", O_RDONLY) );
EC_NEG1_LOG( fchdir(ad_data_fileno(ad)) );
- EC_ZERO_LOG( sys_fsetxattr(".", AD_EA_META, ad->ad_data, AD_DATASZ_EA, 0) );
+ EC_ZERO_LOG( sys_lsetxattr(".", AD_EA_META, ad->ad_data, AD_DATASZ_EA, 0) );
EC_NEG1_LOG( fchdir(cwd) );
cwd = -1;
} else {
static int ad_header_read_ea(const char *path, struct adouble *ad, struct stat *hst);
static int ad_header_upgrade_ea(struct adouble *ad, const char *name);
static int ad_reso_size(const char *path, int adflags, struct adouble *ad);
-static const char *ad_path_osx(const char *path, int adflags);
static int ad_mkrf_osx(const char *path);
{
ssize_t rforklen;
int oflags;
+ int opened = 0;
LOG(log_debug, logtype_default, "ad_open_hf_ea(\"%s\", %s, %04o)",
path, adflags2logstr(adflags), mode);
LOG(log_debug, logtype_default, "ad_open_hf_ea(\"%s\"): opening base file for meta adouble EA", path);
if ((ad_meta_fileno(ad) = open(path, oflags)) == -1)
goto error;
+ opened = 1;
ad->ad_mdp->adf_flags = oflags;
}
ad->ad_mdp->adf_refcount = 1;
return 0;
error:
- if (ad_meta_fileno(ad) != -1) {
+ if (opened && ad_meta_fileno(ad) != -1) {
close(ad_meta_fileno(ad));
ad_meta_fileno(ad) = -1;
ad->ad_mdp->adf_refcount = 0;
}
- return ad_error(ad, adflags);
+ (void)ad_reso_size(path, adflags, ad);
+ return -1;
}
static int ad_open_hf(const char *path, int adflags, int mode, struct adouble *ad)
}
#endif
- EC_NEG1_LOG( ad_reso_size(path, adflags, ad));
+ (void)ad_reso_size(path, adflags, ad);
EC_CLEANUP:
if (ret != 0) {
adflags |= ADFLAGS_DF;
if (ad->ad_inited != AD_INITED) {
- ad->ad_adflags = adflags;
+ ad->ad_adflags = (adflags & ~(ADFLAGS_DF | ADFLAGS_HF | ADFLAGS_RF));
ad->ad_inited = AD_INITED;
} else {
ad->ad_open_forks = ((ad->ad_data_fork.adf_refcount > 0) ? ATTRBIT_DOPEN : 0);
}
EC_CLEANUP:
- return ret;
+ LOG(log_debug, logtype_default, "ad_open(\"%s\", %s): result: %d",
+ fullpathname(path), adflags2logstr(ad->ad_adflags), ret);
+
+ EC_EXIT;
}
/*!