trailing_slash = cp && !cp[1];
if (mkpath_dest_arg && statret < 0 && (cp || file_total > 1)) {
+ int save_errno = errno;
int ret = make_path(dest_path, file_total > 1 && !trailing_slash ? 0 : MKP_DROP_NAME);
if (ret < 0)
goto mkdir_error;
- if (INFO_GTE(NAME, 1)) {
+ if (ret && INFO_GTE(NAME, 1)) {
if (file_total == 1 || trailing_slash)
*cp = '\0';
rprintf(FINFO, "created %d director%s for %s\n", ret, ret == 1 ? "y" : "ies", dest_path);
if (file_total == 1 || trailing_slash)
*cp = '/';
}
- if (file_total > 1 || trailing_slash)
+ if (ret)
statret = do_stat(dest_path, &st);
+ else
+ errno = save_errno;
}
if (statret == 0) {
mkdir $deep_dir/new
$RSYNC -aiv --mkpath from/text $deep_dir/new
test -f $deep_dir/new/text || test_fail "'text' file not found in $deep_dir/new dir"
+
+# ... and an existing path when an alternate dest filename is specified
+$RSYNC -aiv --mkpath from/text $deep_dir/new/text2
+test -f $deep_dir/new/text2 || test_fail "'text2' file not found in $deep_dir/new dir"
rm -rf to/foo
# Try the tests again with multiple source args