Commit 4574e809 authored by Ivan Čukić's avatar Ivan Čukić 👁

Add a notification when mount failed because of a non empty mount point

CryFS does not report FUSE errors via return codes. This checks whether
the command output contained 'nonempty' before checking whether the
command ran successfully.

BUG:401413
parent 54a7b6cb
......@@ -147,6 +147,9 @@ FutureResult<> CryFsBackend::mount(const Device &device,
const auto out = process->readAllStandardOutput();
const auto err = process->readAllStandardError();
qDebug() << "OUT: " << out;
qDebug() << "ERR: " << err;
const auto exitCode = (ExitCode) process->exitCode();
auto upgradeFileSystem = [this, device, mountPoint, payload] {
......@@ -168,15 +171,15 @@ FutureResult<> CryFsBackend::mount(const Device &device,
};
return
err.contains("'nonempty'") ?
Result<>::error(Error::CommandError,
i18n("The mount point directory is not empty, refusing to open the vault")) :
// If all went well, just return success
(process->exitStatus() == QProcess::NormalExit && exitCode == ExitCode::Success) ?
Result<>::success() :
// If we tried to mount into a non-empty location, report
err.contains("'nonempty'") ?
Result<>::error(Error::CommandError,
i18n("The mount point directory is not empty, refusing to open the vault")) :
exitCode == ExitCode::WrongPassword ?
Result<>::error(Error::BackendError,
i18n("You entered the wrong password")) :
......
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