extend use of lseek_blockwise functions

This commit is contained in:
Ondrej Kozina
2017-12-07 12:49:16 +01:00
committed by Milan Broz
parent ed19ddf620
commit 82d81b9e86
4 changed files with 16 additions and 16 deletions

View File

@@ -183,9 +183,9 @@ int LUKS_encrypt_to_storage(char *src, size_t srcLength,
if (devfd < 0)
goto out;
if (lseek(devfd, sector * SECTOR_SIZE, SEEK_SET) == -1 ||
write_blockwise(devfd, device_block_size(device),
device_alignment(device), src, srcLength) == -1)
if (write_lseek_blockwise(devfd, device_block_size(device),
device_alignment(device), src, srcLength,
sector * SECTOR_SIZE) < 0)
goto out;
r = 0;
@@ -239,9 +239,9 @@ int LUKS_decrypt_from_storage(char *dst, size_t dstLength,
if (devfd < 0)
goto bad;
if (lseek(devfd, sector * SECTOR_SIZE, SEEK_SET) == -1 ||
read_blockwise(devfd, device_block_size(device),
device_alignment(device), dst, dstLength) == -1)
if (read_lseek_blockwise(devfd, device_block_size(device),
device_alignment(device), dst, dstLength,
sector * SECTOR_SIZE) < 0)
goto bad;
close(devfd);