Skip to content

Commit 9c7dc43

Browse files
committed
Fixed bug where basis file is truncated on remote copy
The truncation of the basis file caused the File Stream API to compute the signature against an empty file, effectively removing all performance benefits from the RSYNC algorithm. Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 8bf3d06 commit 9c7dc43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcfnet/file_stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,8 @@ bool FileStreamFetch(
10221022
assert(basis != NULL);
10231023
assert(dest != NULL);
10241024

1025-
/* Let's make sure the basis file exists */
1026-
FILE *file = safe_fopen_create_perms(basis, "wb", perms);
1025+
/* Let's make sure the basis file exists, but don't truncate it */
1026+
FILE *file = safe_fopen_create_perms(basis, "ab+", perms);
10271027
if (file != NULL)
10281028
{
10291029
fclose(file);

0 commit comments

Comments
 (0)