Improved error handling in luks2().close()

This commit is contained in:
Anton Hvornum 2022-02-09 11:58:18 +01:00
parent 3129cf79f4
commit 216ca90b29
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 2 additions and 2 deletions

View File

@ -201,8 +201,8 @@ class luks2:
return self.mapdev
def close(self, mountpoint :Optional[str] = None) -> bool:
if not mountpoint:
mountpoint = self.mapdev
if not mountpoint and self.mapdev:
mountpoint = self.mapdev.path
if mountpoint:
SysCommand(f'/usr/bin/cryptsetup close {mountpoint}')