diff options
| -rw-r--r-- | rbutil/rbutilqt/autodetection.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/autodetection.cpp b/rbutil/rbutilqt/autodetection.cpp index a359b91..8f47883 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 |