Asks offline reencryption confirmation only with image files.

If auto-detection fails for other reason just return the
error. Users may now bypass active device auto-detection
with --force-offline-reencrypt option.
This commit is contained in:
Ondrej Kozina
2022-04-06 19:14:19 +02:00
parent 31c4afbc17
commit b661452e3a

View File

@@ -97,13 +97,15 @@ static int get_active_device_name(struct crypt_device *cd, const char *data_devi
if (!ARG_SET(OPT_BATCH_MODE_ID))
log_std(_("Auto-detected active dm device '%s' for data device %s.\n"), *r_active_name, data_device);
} else if (r < 0) {
if (r == -ENOTBLK)
log_std(_("Device %s is not a block device.\n"), data_device);
else
if (r != -ENOTBLK) {
log_err(_("Failed to auto-detect device %s holders."), data_device);
return -EINVAL;
}
r = -EINVAL;
if (!ARG_SET(OPT_BATCH_MODE_ID)) {
log_std(_("Device %s is not a block device.\n"), data_device);
r = asprintf(&msg, _("Unable to decide if device %s is activated or not.\n"
"Are you sure you want to proceed with reencryption in offline mode?\n"
"It may lead to data corruption if the device is actually activated.\n"