From 14979b1630bbc853ffdafce00250efb5df0a5f75 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 24 Feb 2020 15:21:31 +0100 Subject: [PATCH] [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. --- src/libcalamares/partition/Mount.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/partition/Mount.cpp b/src/libcalamares/partition/Mount.cpp index 91fcefff5..aa30c9d92 100644 --- a/src/libcalamares/partition/Mount.cpp +++ b/src/libcalamares/partition/Mount.cpp @@ -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; }