copy_bytes() recover function

The version of copy_bytes() in util/recover.c had fallen behind
the internal version in files.c which had received some
analyzer changes in 4bc5e26082 from
December 2022.

This synchronizes them, and addresses a couple of other static
analysis recommendations.
This commit is contained in:
nhmall
2024-10-05 10:54:54 -04:00
parent 5af723669e
commit 6f8c36df70
2 changed files with 10 additions and 5 deletions

View File

@@ -4456,9 +4456,10 @@ boolean
copy_bytes(int ifd, int ofd)
{
char buf[BUFSIZ];
int nfrom, nto = 0;
int nfrom, nto;
do {
nto = 0;
nfrom = read(ifd, buf, BUFSIZ);
/* read can return -1 */
if (nfrom >= 0 && nfrom <= BUFSIZ)