Skip to content

Commit 381a2d1

Browse files
committed
libmfu: fix: with dsync no longer ensured that target directory exists as before with dcmp
1 parent 9a7fa37 commit 381a2d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/common/mfu_flist_copy.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ static int mfu_create_directory(mfu_flist list, uint64_t idx,
508508
}
509509

510510
/* Skipping the destination directory ONLY if it already exists.
511-
* If we are doing a dsync operation it is safe to assume that
512-
* the destination directory already exists. The reason that
511+
* If we are doing a sync operation and if the dest dir does not
512+
* exist, we need to create it. The reason that
513513
* the dest_path and the destpath->path are compared is because
514514
* if we are syncing two directories we want the tree to have the
515515
* same number of levels. If dsync is on then only the contents of
@@ -519,8 +519,10 @@ static int mfu_create_directory(mfu_flist list, uint64_t idx,
519519
* not dsync is on happens prior to this in
520520
* mfu_param_path_copy_dest. */
521521

522-
if ((mfu_copy_opts->do_sync) &&
523-
(strncmp(dest_path, destpath->path, strlen(dest_path)) == 0)) {
522+
if (mfu_copy_opts->do_sync &&
523+
(strncmp(dest_path, destpath->path, strlen(dest_path)) == 0) &&
524+
destpath->target_stat_valid)
525+
{
524526
mfu_free(&dest_path);
525527
return 0;
526528
}

0 commit comments

Comments
 (0)