mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Proper handle error in device block get.
This commit is contained in:
@@ -110,9 +110,12 @@ static int LUKS_endec_template(char *src, size_t srcLength,
|
|||||||
int r = -1;
|
int r = -1;
|
||||||
int bsize = device_block_size(crypt_metadata_device(ctx));
|
int bsize = device_block_size(crypt_metadata_device(ctx));
|
||||||
|
|
||||||
|
if (bsize <= 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if(dmDir == NULL) {
|
if(dmDir == NULL) {
|
||||||
log_err(ctx, _("Failed to obtain device mapper directory."));
|
log_err(ctx, _("Failed to obtain device mapper directory."));
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if(asprintf(&name,"temporary-cryptsetup-%d",getpid()) == -1 ||
|
if(asprintf(&name,"temporary-cryptsetup-%d",getpid()) == -1 ||
|
||||||
asprintf(&fullpath,"%s/%s",dmDir,name) == -1 ||
|
asprintf(&fullpath,"%s/%s",dmDir,name) == -1 ||
|
||||||
|
|||||||
Reference in New Issue
Block a user