From c00652b0a222b6d5a25437b972d34d72619b00a8 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 2 Sep 2007 09:36:28 +0000 Subject: use the getmntend api here too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14574 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/autodetection.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'rbutil/rbutilqt/autodetection.cpp') diff --git a/rbutil/rbutilqt/autodetection.cpp b/rbutil/rbutilqt/autodetection.cpp index a359b91afd..8f478835be 100644 --- a/rbutil/rbutilqt/autodetection.cpp +++ b/rbutil/rbutilqt/autodetection.cpp @@ -117,17 +117,15 @@ QStringList Autodetection::getMountpoints() #elif defined(Q_OS_LINUX) QStringList tempList; - FILE *fp = fopen( "/proc/mounts", "r" ); - if( !fp ) return tempList; - char *dev, *dir; - while( fscanf( fp, "%as %as %*s %*s %*s %*s", &dev, &dir ) != EOF ) - { - tempList << dir; - free( dev ); - free( dir ); - } - fclose( fp ); - + FILE *mn = setmntent("/etc/mtab", "r"); + if(!mn) + return QStringList(""); + + struct mntent *ent; + while((ent = getmntent(mn))) + tempList << QString(ent->mnt_dir); + endmntent(mn); + return tempList; #else #error Unknown Plattform -- cgit v1.2.3