+static int RF_copyfile_adouble(VFS_FUNC_ARGS_COPYFILE)
+/* const struct vol *vol, int sfd, const char *src, const char *dst */
+{
+ EC_INIT;
+ bstring s = NULL, d = NULL;
+ char *dup1 = NULL;
+ char *dup2 = NULL;
+ char *dup3 = NULL;
+ char *dup4 = NULL;
+ const char *name = NULL;
+ const char *dir = NULL;
+
+ struct stat st;
+ EC_ZERO(stat(dst, &st));
+
+ if (S_ISDIR(st.st_mode)) {
+ /* build src path to AppleDouble file*/
+ EC_NULL(s = bfromcstr(src));
+ EC_ZERO(bcatcstr(s, "/.AppleDouble/.Parent"));
+
+ /* build dst path to AppleDouble file*/
+ EC_NULL(d = bfromcstr(dst));
+ EC_ZERO(bcatcstr(d, "/.AppleDouble/.Parent"));
+ } else {
+ /* get basename */
+
+ /* build src path to AppleDouble file*/
+ EC_NULL(dup1 = strdup(src));
+ EC_NULL(name = basename(strdup(dup1)));
+
+ EC_NULL(dup2 = strdup(src));
+ EC_NULL(dir = dirname(dup2));
+ EC_NULL(s = bfromcstr(dir));
+ EC_ZERO(bcatcstr(s, "/.AppleDouble/"));
+ EC_ZERO(bcatcstr(s, name));
+
+ /* build dst path to AppleDouble file*/
+ EC_NULL(dup4 = strdup(dst));
+ EC_NULL(name = basename(strdup(dup4)));
+
+ EC_NULL(dup3 = strdup(dst));
+ EC_NULL(dir = dirname(dup3));
+ EC_NULL(d = bfromcstr(dir));
+ EC_ZERO(bcatcstr(d, "/.AppleDouble/"));
+ EC_ZERO(bcatcstr(d, name));
+ }
+
+ EC_ZERO(copy_file(sfd, cfrombstr(s), cfrombstr(d), 0666));
+
+EC_CLEANUP:
+ bdestroy(s);
+ bdestroy(d);
+ if (dup1) free(dup1);
+ if (dup2) free(dup2);
+ if (dup3) free(dup3);
+ if (dup4) free(dup4);
+
+ EC_EXIT;
+}
+
+#ifdef HAVE_SOLARIS_ACLS