static inline MountEntries
getMountEntries()
{
- // use "/etc/mtab" by default,
- // fallback to "/proc/mounts"
- return Mount::getEntries(/* "/etc/mtab" */);
+ return Mount::getEntries();
}
};
#include "zypp/media/Mount.h"
#include "zypp/media/MediaException.h"
+#include "zypp/PathInfo.h"
+
#ifndef N_
#define N_(STR) STR
#endif
if( mtab.empty())
{
- mtabs.push_back("/etc/mtab");
mtabs.push_back("/proc/mounts");
+ // Also read /etc/mtab if it is a file (on newer sytems
+ // mtab is a symlink to /proc/mounts).
+ // Reason for this is the different representation of
+ // mounted loop devices:
+ // /etc/mtab: /tmp/SLES-11-SP2-MINI-ISO-x86_64-Beta2-DVD.iso on /mnt type iso9660 (ro,loop=/dev/loop0)
+ // /proc/mounts: /dev/loop0 /mnt iso9660 ro,relatime 0 0
+ if ( PathInfo( "/etc/mtab", PathInfo::LSTAT ).isFile() )
+ mtabs.push_back("/etc/mtab");
}
else
{
*
* @param mtab The name of the (mounted) file system description
* file to read from. This file should be one /etc/mtab,
- * /etc/fstab or /proc/mounts. Default is to try the
- * /etc/mtab and fail back to /proc/mounts.
+ * /etc/fstab or /proc/mounts. Default is to read
+ * /proc/mounts and /etc/mtab in case is not a symlink
+ * to /proc/mounts.
* @returns A vector with mount entries or empty vector if reading
* or parsing of the mtab file(s) failed.
*/