Skip to content

Commit

Permalink
fix buffer size on read; close write file on read open error; see #24
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarratt committed Jul 12, 2021
1 parent 3386515 commit 1387fbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backuppc/bpc_poolWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,11 @@ int bpc_poolWrite_copyToPool(bpc_poolWrite_info *info, char *poolPath, char *fil
if ( (fdRead = open(fileName, O_RDONLY)) < 0 ) {
info->errorCnt++;
bpc_logErrf("bpc_poolWrite_copyToPool: can't open %s for reading", fileName);
close(fdWrite);
return -1;
}

while ( (nRead = read(fdRead, info->buffer, sizeof(info->buffer))) > 0 ) {
while ( (nRead = read(fdRead, info->buffer, BPC_POOL_WRITE_BUF_SZ)) > 0 ) {
uchar *p = info->buffer;
int thisWrite;

Expand Down

0 comments on commit 1387fbf

Please sign in to comment.