Skip to content

Commit 04a0d69

Browse files
derrickstoleedscho
authored andcommitted
gvfs-helper: do one read in my_copy_fd_len_tail()
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 031b41c commit 04a0d69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

gvfs-helper.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,18 +2040,18 @@ static int my_copy_fd_len_tail(int fd_in, int fd_out, ssize_t nr_bytes_total,
20402040
{
20412041
memset(buf_tail, 0, tail_len);
20422042

2043+
if (my_copy_fd_len(fd_in, fd_out, nr_bytes_total) < 0)
2044+
return -1;
2045+
20432046
if (nr_bytes_total < tail_len)
2044-
return my_copy_fd_len(fd_in, fd_out, nr_bytes_total);
2047+
return 0;
20452048

2046-
if (my_copy_fd_len(fd_in, fd_out, (nr_bytes_total - tail_len)) < 0)
2047-
return -1;
2049+
/* Reset the position to read the tail */
2050+
lseek(fd_in, -tail_len, SEEK_CUR);
20482051

20492052
if (xread(fd_in, (char *)buf_tail, tail_len) != tail_len)
20502053
return -1;
20512054

2052-
if (write_in_full(fd_out, buf_tail, tail_len) < 0)
2053-
return -1;
2054-
20552055
return 0;
20562056
}
20572057

0 commit comments

Comments
 (0)