diff options
-rw-r--r-- | rbutil/rbutilqt/base/autodetection.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp index 8e91dc32b1..bafa88d8bf 100644 --- a/rbutil/rbutilqt/base/autodetection.cpp +++ b/rbutil/rbutilqt/base/autodetection.cpp | |||
@@ -265,8 +265,11 @@ QString Autodetection::resolveMountPoint(QString device) | |||
265 | 265 | ||
266 | struct mntent *ent; | 266 | struct mntent *ent; |
267 | while((ent = getmntent(mn))) { | 267 | while((ent = getmntent(mn))) { |
268 | if(QString(ent->mnt_fsname).startsWith(device) | 268 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a |
269 | && QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) { | 269 | // MacPod. |
270 | if(QString(ent->mnt_fsname) == device | ||
271 | && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) | ||
272 | || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) { | ||
270 | endmntent(mn); | 273 | endmntent(mn); |
271 | qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir; | 274 | qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir; |
272 | return QString(ent->mnt_dir); | 275 | return QString(ent->mnt_dir); |
@@ -282,8 +285,11 @@ QString Autodetection::resolveMountPoint(QString device) | |||
282 | 285 | ||
283 | num = getmntinfo(&mntinf, MNT_WAIT); | 286 | num = getmntinfo(&mntinf, MNT_WAIT); |
284 | while(num--) { | 287 | while(num--) { |
285 | if(QString(mntinf->f_mntfromname).startsWith(device) | 288 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a |
286 | && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) { | 289 | // MacPod. |
290 | if(QString(mntinf->f_mntfromname) == device | ||
291 | && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) | ||
292 | || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) { | ||
287 | qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname; | 293 | qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname; |
288 | return QString(mntinf->f_mntonname); | 294 | return QString(mntinf->f_mntonname); |
289 | } | 295 | } |
@@ -324,8 +330,13 @@ QString Autodetection::resolveDevicename(QString path) | |||
324 | 330 | ||
325 | struct mntent *ent; | 331 | struct mntent *ent; |
326 | while((ent = getmntent(mn))) { | 332 | while((ent = getmntent(mn))) { |
327 | if(QString(ent->mnt_dir).startsWith(path) | 333 | // check for valid filesystem type. |
328 | && QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)) { | 334 | // Linux can handle hfs (and hfsplus), so consider it a valid file |
335 | // system. Otherwise resolving the device name would fail, which in | ||
336 | // turn would make it impossible to warn about a MacPod. | ||
337 | if(QString(ent->mnt_dir) == path | ||
338 | && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) | ||
339 | || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) { | ||
329 | endmntent(mn); | 340 | endmntent(mn); |
330 | qDebug() << "[Autodetect] device name is" << ent->mnt_fsname; | 341 | qDebug() << "[Autodetect] device name is" << ent->mnt_fsname; |
331 | return QString(ent->mnt_fsname); | 342 | return QString(ent->mnt_fsname); |
@@ -341,8 +352,11 @@ QString Autodetection::resolveDevicename(QString path) | |||
341 | 352 | ||
342 | num = getmntinfo(&mntinf, MNT_WAIT); | 353 | num = getmntinfo(&mntinf, MNT_WAIT); |
343 | while(num--) { | 354 | while(num--) { |
344 | if(QString(mntinf->f_mntonname).startsWith(path) | 355 | // check for valid filesystem type. OS X can handle hfs (hfs+ is |
345 | && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) { | 356 | // treated as hfs), BSD should be the same. |
357 | if(QString(mntinf->f_mntonname) == path | ||
358 | && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) | ||
359 | || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) { | ||
346 | qDebug() << "[Autodetect] device name is" << mntinf->f_mntfromname; | 360 | qDebug() << "[Autodetect] device name is" << mntinf->f_mntfromname; |
347 | return QString(mntinf->f_mntfromname); | 361 | return QString(mntinf->f_mntfromname); |
348 | } | 362 | } |