mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 11:20:10 +01:00
Print error message if device exists but as other subsystem.
This commit is contained in:
15
lib/setup.c
15
lib/setup.c
@@ -2047,9 +2047,10 @@ int crypt_activate_by_passphrase(struct crypt_device *cd,
|
|||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
ci = crypt_status(NULL, name);
|
ci = crypt_status(NULL, name);
|
||||||
if (ci == CRYPT_INVALID)
|
if (ci == CRYPT_INVALID) {
|
||||||
|
log_err(cd, _("Cannot use device %s, name is invalid or still in use.\n"), name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
else if (ci >= CRYPT_ACTIVE) {
|
} else if (ci >= CRYPT_ACTIVE) {
|
||||||
log_err(cd, _("Device %s already exists.\n"), name);
|
log_err(cd, _("Device %s already exists.\n"), name);
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
@@ -2104,9 +2105,10 @@ int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
|
|||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
ci = crypt_status(NULL, name);
|
ci = crypt_status(NULL, name);
|
||||||
if (ci == CRYPT_INVALID)
|
if (ci == CRYPT_INVALID) {
|
||||||
|
log_err(cd, _("Cannot use device %s, name is invalid or still in use.\n"), name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
else if (ci >= CRYPT_ACTIVE) {
|
} else if (ci >= CRYPT_ACTIVE) {
|
||||||
log_err(cd, _("Device %s already exists.\n"), name);
|
log_err(cd, _("Device %s already exists.\n"), name);
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
@@ -2198,9 +2200,10 @@ int crypt_activate_by_volume_key(struct crypt_device *cd,
|
|||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
ci = crypt_status(NULL, name);
|
ci = crypt_status(NULL, name);
|
||||||
if (ci == CRYPT_INVALID)
|
if (ci == CRYPT_INVALID) {
|
||||||
|
log_err(cd, _("Cannot use device %s, name is invalid or still in use.\n"), name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
else if (ci >= CRYPT_ACTIVE) {
|
} else if (ci >= CRYPT_ACTIVE) {
|
||||||
log_err(cd, _("Device %s already exists.\n"), name);
|
log_err(cd, _("Device %s already exists.\n"), name);
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user