[libcalamares] TemporaryMount with backwards logic

- because mount() returns an exit code, and 0 is "success",
  the if (!code) was backwards: when mounting succeeded, the
  TemporaryMount object thought it failed.
- This leads to temp-mounts being left *all over* the place
  from os-prober and fstab-handling.
This commit is contained in:
Adriaan de Groot 2020-02-24 15:21:31 +01:00
parent a865620f90
commit 14979b1630

View File

@ -105,8 +105,9 @@ TemporaryMount::TemporaryMount( const QString& devicePath, const QString& filesy
m_d->m_devicePath = devicePath;
m_d->m_mountDir.setAutoRemove( false );
int r = mount( devicePath, m_d->m_mountDir.path(), filesystemName, options );
if ( !r )
if ( r )
{
cWarning() << "Mount of" << devicePath << "on" << m_d->m_mountDir.path() << "failed, code" << r;
delete m_d;
m_d = nullptr;
}
@ -116,7 +117,12 @@ TemporaryMount::~TemporaryMount()
{
if ( m_d )
{
unmount( m_d->m_devicePath, { "-R" } );
int r = unmount( m_d->m_devicePath, { "-R" } );
if ( r )
{
cWarning() << "UnMount of temporary" << m_d->m_devicePath << "on" << m_d->m_mountDir.path()
<< "failed, code" << r;
}
delete m_d;
m_d = nullptr;
}