Move check for loop device inside crypt_loop_backing_file.

It also fixes minor regression where we return backing file
for partition on top of loop device when prompting for passphrase.
Partition on loop has different major number so it should not be
considered loop device at all.
This commit is contained in:
Ondrej Kozina
2019-10-03 15:58:47 +02:00
parent c4c4f9d159
commit 62b580904b
4 changed files with 12 additions and 13 deletions

View File

@@ -252,7 +252,12 @@ static char *_sysfs_backing_file(const char *loop)
char *crypt_loop_backing_file(const char *loop)
{
char *bf = _sysfs_backing_file(loop);
char *bf;
if (!crypt_loop_device(loop))
return NULL;
bf = _sysfs_backing_file(loop);
return bf ?: _ioctl_backing_file(loop);
}