umount卸载目录挂载

This commit is contained in:
zhaominyong 2022-01-25 16:36:17 +08:00
parent a818cf00e1
commit 7ef30fd92c
1 changed files with 12 additions and 4 deletions

View File

@ -72,12 +72,20 @@ bool MountBackupProcess::umountBackupPartition()
*/
bool MountBackupProcess::umount(const QString& mountPath)
{
if (0 == ::umount(mountPath.toUtf8().data()))
return true;
QStringList arguments;
arguments << mountPath;
m_p->start("umount", arguments);
if (!m_p->waitForStarted()) {
qCritical() << tr("umount %1 process start failed!").arg(mountPath);
return false;
}
qCritical() << QString("%1 umount failed, error is %2(%3)").arg(mountPath).arg(strerror(errno)).arg(QString::number(errno));
if (!m_p->waitForFinished()) {
qCritical() << tr("umount %1 process end failed!").arg(mountPath);
return false;
}
return false;
return true;
}
/**