Reuse device file desriptors.

This commit is contained in:
Ondrej Kozina
2019-05-10 15:19:33 +02:00
committed by Milan Broz
parent ecbb9cfa90
commit ee57b865b0
14 changed files with 105 additions and 118 deletions

View File

@@ -35,9 +35,8 @@ static int INTEGRITY_read_superblock(struct crypt_device *cd,
int devfd, r;
devfd = device_open(cd, device, O_RDONLY);
if(devfd < 0) {
if(devfd < 0)
return -EINVAL;
}
if (read_lseek_blockwise(devfd, device_block_size(cd, device),
device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb) ||
@@ -55,7 +54,6 @@ static int INTEGRITY_read_superblock(struct crypt_device *cd,
r = 0;
}
close(devfd);
return r;
}