- if (ad->ad_vers == AD_VERSION_EA && size == 0) {
-#if HAVE_EAFD
- EC_NEG1( sys_lremovexattr(of_name(ofork), AD_EA_RESO) );
-#else
- EC_NEG1( unlink(ad->ad_ops->ad_path(ad->ad_name, 0)) );
-#endif
- }
+ /*
+ * We can't delete 0 byte size resource forks either, because a
+ * fork may reference the adouble handle with an open fd for the
+ * file, which means we would only delete the directory entry, not
+ * the file. Subsequently all code that works with fork handles
+ * finds the fork open, so eg flushing a fork (ad_flush()) will
+ * recreate ._ files. The correct place to delete 0 byte sized
+ * resource forks is in of_closefork().
+ */