mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 21:29:59 +01:00
USe ARG_SET macro to check that device size is set for resize.
And move the check to the beginning of function.
This commit is contained in:
@@ -712,7 +712,7 @@ static int action_resize(void)
|
||||
int r;
|
||||
size_t passwordLen;
|
||||
struct crypt_active_device cad;
|
||||
uint64_t dev_size;
|
||||
uint64_t dev_size = 0;
|
||||
char *password = NULL;
|
||||
struct crypt_device *cd = NULL;
|
||||
|
||||
@@ -725,6 +725,11 @@ static int action_resize(void)
|
||||
if (r)
|
||||
goto out;
|
||||
|
||||
if (ARG_SET(OPT_DEVICE_SIZE_ID))
|
||||
dev_size = ARG_UINT64(OPT_DEVICE_SIZE_ID) / SECTOR_SIZE;
|
||||
else if (ARG_SET(OPT_SIZE_ID))
|
||||
dev_size = ARG_UINT64(OPT_SIZE_ID);
|
||||
|
||||
if (cad.flags & CRYPT_ACTIVATE_KEYRING_KEY) {
|
||||
if (ARG_SET(OPT_DISABLE_KEYRING_ID)) {
|
||||
r = -EINVAL;
|
||||
@@ -758,11 +763,6 @@ static int action_resize(void)
|
||||
}
|
||||
|
||||
resize:
|
||||
if (ARG_UINT64(OPT_DEVICE_SIZE_ID))
|
||||
dev_size = ARG_UINT64(OPT_DEVICE_SIZE_ID) / SECTOR_SIZE;
|
||||
else
|
||||
dev_size = ARG_UINT64(OPT_SIZE_ID);
|
||||
|
||||
if (r >= 0)
|
||||
r = crypt_resize(cd, action_argv[0], dev_size);
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user