Use read/write buffer functions where appropriate.

This commit is contained in:
Ondrej Kozina
2015-11-30 16:44:17 +01:00
committed by Milan Broz
parent 327ebccdb1
commit 2d298071e4
3 changed files with 11 additions and 12 deletions

View File

@@ -201,7 +201,7 @@ int LUKS_hdr_backup(const char *backup_file, struct crypt_device *ctx)
r = -EINVAL;
goto out;
}
if (write(devfd, buffer, buffer_size) < buffer_size) {
if (write_buffer(devfd, buffer, buffer_size) < buffer_size) {
log_err(ctx, _("Cannot write header backup file %s.\n"), backup_file);
r = -EIO;
goto out;
@@ -253,7 +253,7 @@ int LUKS_hdr_restore(
goto out;
}
if (read(devfd, buffer, buffer_size) < buffer_size) {
if (read_buffer(devfd, buffer, buffer_size) < buffer_size) {
log_err(ctx, _("Cannot read header backup file %s.\n"), backup_file);
r = -EIO;
goto out;
@@ -498,7 +498,7 @@ int LUKS_read_phdr_backup(const char *backup_file,
return -ENOENT;
}
if (read(devfd, hdr, hdr_size) < hdr_size)
if (read_buffer(devfd, hdr, hdr_size) < hdr_size)
r = -EIO;
else {
LUKS_fix_header_compatible(hdr);