- if (fd1 != -1 && !S_ISREG(st.st_mode)) {
- rprintf(FERROR,"%s : not a regular file (recv_files)\n",fnamecmp);
- receive_data(f_in,NULL,-1,NULL,file->length);
+ if (fd1 != -1 && S_ISDIR(st.st_mode) && fnamecmp == fname) {
+ /* this special handling for directories
+ * wouldn't be necessary if robust_rename()
+ * and the underlying robust_unlink could cope
+ * with directories
+ */
+ rprintf(FERROR,"recv_files: %s is a directory\n",
+ full_fname(fnamecmp));
+ receive_data(f_in, NULL, -1, NULL, file->length);