set to yes, then Netatalk will attempt to recursively delete any
vetoed files and directories. FR #82.
* UPD: systemd unit dir is /usr/lib/systemd/system .
+* FIX: Saving files from application like MS Word may result in the file
+ loosing metadata like the Finder label. Bug #521.
Changes in 3.0.4
================
}
goto err_temp_to_dest;
}
+
+ if (AD_META_OPEN(adsp) || AD_META_OPEN(addp)) {
+ struct adouble adtmp;
+ bool opened_ads, opened_add;
+
+ ad_init(&adtmp, vol);
+ ad_init_offsets(&adtmp);
+
+ if (!AD_META_OPEN(adsp)) {
+ if (ad_open(adsp, p, ADFLAGS_HF) != 0)
+ return -1;
+ opened_ads = true;
+ }
+
+ if (!AD_META_OPEN(addp)) {
+ if (ad_open(addp, upath, ADFLAGS_HF) != 0)
+ return -1;
+ opened_add = true;
+ }
+
+ if (ad_copy_header(&adtmp, adsp) != 0)
+ goto err_temp_to_dest;
+ if (ad_copy_header(adsp, addp) != 0)
+ goto err_temp_to_dest;
+ if (ad_copy_header(addp, &adtmp) != 0)
+ goto err_temp_to_dest;
+ ad_flush(adsp);
+ ad_flush(addp);
+
+ if (opened_ads)
+ ad_close(adsp, ADFLAGS_HF);
+ if (opened_add)
+ ad_close(addp, ADFLAGS_HF);
+ }
+
+ /* FIXME: we should switch ressource fork too */
/* here we need to reopen if crossdev */
if (sid && ad_setid(addp, destst.st_dev, destst.st_ino, sid, sdir->d_did, vol->v_stamp))
struct vol;
extern void ad_init (struct adouble *, const struct vol * restrict);
extern void ad_init_old (struct adouble *ad, int flags, int options);
+extern int ad_init_offsets(struct adouble *ad);
extern int ad_open (struct adouble *ad, const char *path, int adflags, ...);
extern int ad_openat (struct adouble *, int dirfd, const char *path, int adflags, ...);
extern int ad_refresh (const char *path, struct adouble *);
return 0;
}
-/* ----------------------------------- */
-static int new_ad_header(struct adouble *ad, const char *path, struct stat *stp, int adflags)
+
+/**
+ * Initialize offset pointers
+ */
+int ad_init_offsets(struct adouble *ad)
{
const struct entry *eid;
- uint16_t ashort;
- struct stat st;
- LOG(log_debug, logtype_ad, "new_ad_header(\"%s\")", path);
-
- if (ad->ad_magic == AD_MAGIC) {
- LOG(log_debug, logtype_ad, "new_ad_header(\"%s\"): already initialized", path);
+ if (ad->ad_magic == AD_MAGIC)
return 0;
- }
ad->ad_magic = AD_MAGIC;
ad->ad_version = ad->ad_vers & 0x0f0000;
eid++;
}
+ return 0;
+}
+
+/* ----------------------------------- */
+static int new_ad_header(struct adouble *ad, const char *path, struct stat *stp, int adflags)
+{
+ const struct entry *eid;
+ uint16_t ashort;
+ struct stat st;
+
+ LOG(log_debug, logtype_ad, "new_ad_header(\"%s\")", path);
+
+ if (ad_init_offsets(ad) != 0)
+ return -1;
+
/* set default creator/type fields */
memcpy(ad_entry(ad, ADEID_FINDERI) + FINDERINFO_FRTYPEOFF,"\0\0\0\0", 4);
memcpy(ad_entry(ad, ADEID_FINDERI) + FINDERINFO_FRCREATOFF,"\0\0\0\0", 4);