/*!
* Close a struct adouble freeing all resources
+ *
+ * This close the whole thing, regardless of what you pass in adflags!
+ * When open forks are using this struct adouble (ad_refcount>0) the close
+ * request is ignored.
*/
-int ad_close( struct adouble *ad, int adflags _U_)
+int ad_close( struct adouble *ad, int adflags)
{
int err = 0;
+ LOG(log_debug, logtype_default, "ad_close(\"%s\", %s)",
+ cfrombstr(ad->ad_fullpath),
+ adflags2logstr(adflags));
+
+ if (ad->ad_refcount) {
+ LOG(log_debug, logtype_default, "ad_close(\"%s\"): adouble in use by fork, not closing",
+ cfrombstr(ad->ad_fullpath));
+ return 0;
+ }
+
if (ad_data_fileno(ad) != -1) {
if ((ad_data_fileno(ad) == -2) && (ad->ad_data_fork.adf_syml != NULL)) {
free(ad->ad_data_fork.adf_syml);