mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-14 12:20:00 +01:00
Fix status of device if path argument is used. Fix double path prefix for non-existent device path.
This commit is contained in:
@@ -696,6 +696,14 @@ int dm_status_device(struct crypt_device *cd, const char *name)
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct dm_info dmi;
|
struct dm_info dmi;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
/* libdevmapper is too clever and handles
|
||||||
|
* path argument differenly with error.
|
||||||
|
* Fail early here if parameter is non-existent path.
|
||||||
|
*/
|
||||||
|
if (strchr(name, '/') && stat(name, &st) < 0)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
if (dm_init_context(cd))
|
if (dm_init_context(cd))
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|||||||
@@ -374,13 +374,12 @@ static int action_status(void)
|
|||||||
crypt_status_info ci;
|
crypt_status_info ci;
|
||||||
struct crypt_active_device cad;
|
struct crypt_active_device cad;
|
||||||
struct crypt_device *cd = NULL;
|
struct crypt_device *cd = NULL;
|
||||||
struct stat st;
|
|
||||||
char *backing_file;
|
char *backing_file;
|
||||||
const char *device;
|
const char *device;
|
||||||
int path = 0, r = 0;
|
int path = 0, r = 0;
|
||||||
|
|
||||||
/* perhaps a path, not a dm device name */
|
/* perhaps a path, not a dm device name */
|
||||||
if (strchr(action_argv[0], '/') && !stat(action_argv[0], &st))
|
if (strchr(action_argv[0], '/'))
|
||||||
path = 1;
|
path = 1;
|
||||||
|
|
||||||
ci = crypt_status(NULL, action_argv[0]);
|
ci = crypt_status(NULL, action_argv[0]);
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ echo "ACTIVATION FS UUID CHECK (LRW/XTS modes only)"
|
|||||||
for file in $(ls $TST_DIR/tc_*-lrw-* $TST_DIR/tc_*-xts-*) ; do
|
for file in $(ls $TST_DIR/tc_*-lrw-* $TST_DIR/tc_*-xts-*) ; do
|
||||||
echo -n " $file"
|
echo -n " $file"
|
||||||
echo $PASSWORD | $CRYPTSETUP tcryptOpen -r $file $MAP || fail
|
echo $PASSWORD | $CRYPTSETUP tcryptOpen -r $file $MAP || fail
|
||||||
|
$CRYPTSETUP status $MAP >/dev/null || fail
|
||||||
|
$CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail
|
||||||
UUID=$(lsblk -n -o UUID /dev/mapper/$MAP)
|
UUID=$(lsblk -n -o UUID /dev/mapper/$MAP)
|
||||||
$CRYPTSETUP remove $MAP || fail
|
$CRYPTSETUP remove $MAP || fail
|
||||||
[ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed."
|
[ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed."
|
||||||
|
|||||||
Reference in New Issue
Block a user