Skip to content

Commit 88f9f28

Browse files
committed
gvfs-helper: do one read in my_copy_fd_len_tail()
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 5b190ba commit 88f9f28

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
@@ -2021,18 +2021,18 @@ static int my_copy_fd_len_tail(int fd_in, int fd_out, ssize_t nr_bytes_total,
20212021
{
20222022
memset(buf_tail, 0, tail_len);
20232023

2024+
if (my_copy_fd_len(fd_in, fd_out, nr_bytes_total) < 0)
2025+
return -1;
2026+
20242027
if (nr_bytes_total < tail_len)
2025-
return my_copy_fd_len(fd_in, fd_out, nr_bytes_total);
2028+
return 0;
20262029

2027-
if (my_copy_fd_len(fd_in, fd_out, (nr_bytes_total - tail_len)) < 0)
2028-
return -1;
2030+
/* Reset the position to read the tail */
2031+
lseek(fd_in, -tail_len, SEEK_CUR);
20292032

20302033
if (xread(fd_in, (char *)buf_tail, tail_len) != tail_len)
20312034
return -1;
20322035

2033-
if (write_in_full(fd_out, buf_tail, tail_len) < 0)
2034-
return -1;
2035-
20362036
return 0;
20372037
}
20382038

0 commit comments

Comments
 (0)