mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Remove unnecessary goto from LUKS2_hdr_version_unlocked.
This commit is contained in:
@@ -786,14 +786,11 @@ int LUKS2_hdr_version_unlocked(struct crypt_device *cd, const char *backup_file)
|
|||||||
flags |= O_DIRECT;
|
flags |= O_DIRECT;
|
||||||
|
|
||||||
devfd = open(device_path(device), flags);
|
devfd = open(device_path(device), flags);
|
||||||
if (devfd < 0)
|
if (devfd != -1 && (read_lseek_blockwise(devfd, device_block_size(cd, device),
|
||||||
goto err;
|
|
||||||
|
|
||||||
if ((read_lseek_blockwise(devfd, device_block_size(cd, device),
|
|
||||||
device_alignment(device), &hdr, sizeof(hdr), 0) == sizeof(hdr)) &&
|
device_alignment(device), &hdr, sizeof(hdr), 0) == sizeof(hdr)) &&
|
||||||
!memcmp(hdr.magic, LUKS2_MAGIC_1ST, LUKS2_MAGIC_L))
|
!memcmp(hdr.magic, LUKS2_MAGIC_1ST, LUKS2_MAGIC_L))
|
||||||
r = (int)be16_to_cpu(hdr.version);
|
r = (int)be16_to_cpu(hdr.version);
|
||||||
err:
|
|
||||||
if (devfd != -1)
|
if (devfd != -1)
|
||||||
close(devfd);
|
close(devfd);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user