Commit 0946c704 authored by Milan Broz's avatar Milan Broz

Fix status of device if path argument is used. Fix double path prefix for non-existent device path.

parent 90853cc3
......@@ -696,6 +696,14 @@ int dm_status_device(struct crypt_device *cd, const char *name)
{
int r;
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))
return -ENOTSUP;
......
......@@ -374,13 +374,12 @@ static int action_status(void)
crypt_status_info ci;
struct crypt_active_device cad;
struct crypt_device *cd = NULL;
struct stat st;
char *backing_file;
const char *device;
int path = 0, r = 0;
/* 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;
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
echo -n " $file"
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)
$CRYPTSETUP remove $MAP || fail
[ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment