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;
|
int r;
|
||||||
size_t passwordLen;
|
size_t passwordLen;
|
||||||
struct crypt_active_device cad;
|
struct crypt_active_device cad;
|
||||||
uint64_t dev_size;
|
uint64_t dev_size = 0;
|
||||||
char *password = NULL;
|
char *password = NULL;
|
||||||
struct crypt_device *cd = NULL;
|
struct crypt_device *cd = NULL;
|
||||||
|
|
||||||
@@ -725,6 +725,11 @@ static int action_resize(void)
|
|||||||
if (r)
|
if (r)
|
||||||
goto out;
|
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 (cad.flags & CRYPT_ACTIVATE_KEYRING_KEY) {
|
||||||
if (ARG_SET(OPT_DISABLE_KEYRING_ID)) {
|
if (ARG_SET(OPT_DISABLE_KEYRING_ID)) {
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
@@ -758,11 +763,6 @@ static int action_resize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
resize:
|
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)
|
if (r >= 0)
|
||||||
r = crypt_resize(cd, action_argv[0], dev_size);
|
r = crypt_resize(cd, action_argv[0], dev_size);
|
||||||
out:
|
out:
|
||||||
|
|||||||
Reference in New Issue
Block a user