Skip to content

Commit

Permalink
avoid uninitialised QProcess usage
Browse files Browse the repository at this point in the history
`mount.readAllStandardError()` yields the empty string as the QProcess is not
set up yet, i.e. mounting a disk via clicking on it in Dolphin does not work
and instead just shows an unhelpful error.

Remove the block that appears further down in the function again.
Mounting still fails, but with a proper error this time.

Needs more fixing, but this part is obviously wrong.

From @klemensn
  • Loading branch information
sizeofvoid committed Dec 10, 2023
1 parent 9f6b2d9 commit 9aae774
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/blockfilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,12 @@ QString BlockFilesystem::Mount(const Block& block,
return QString();
}

QProcess mount;
const QString mountPoint = createMountPoint(block.id().replace(' ', '_'), uidReply.value());
if (mountPoint.isEmpty()) {
const QString error = "Mount: failed with " + mount.readAllStandardError();
removeMountPoint(mountPoint);
conn.send(msg.createErrorReply("org.freedesktop.UDisks2.Error.Failed", error));
return QString();
}

const auto mountPoint = createMountPoint(block.id().replace(' ', '_'), uidReply.value());
const auto mountProg = getMountCommand();
if (mountProg.isEmpty())
return QString();

QProcess mount;
mount.setProgram(mountProg);

QStringList args;
Expand Down

0 comments on commit 9aae774

Please sign in to comment.