Skip to content

Commit

Permalink
Parse output from mount command correctly.
Browse files Browse the repository at this point in the history
Command output does not have quoting for spaces in mountpoint,
so space-delimited parsing doesn't cut it.
  • Loading branch information
NigelPearson committed Feb 24, 2011
1 parent d8f8919 commit fc2f0a7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mythtv/libs/libmythbase/mythmedia.cpp
Expand Up @@ -379,15 +379,20 @@ bool MythMediaDevice::findMountPath()
QString deviceName;


// Extract the mount point and device name.
#ifdef USE_MOUNT_COMMAND
// Extract mount point and device name from something like:
// /dev/disk0s3 on / (hfs, local, journaled) - Mac OS X
// /dev/hdd on /tmp/AAA BBB type udf (ro) - Linux
stream >> deviceName;
stream >> mountPoint; // throw away the "on" between path and mount
stream >> mountPoint;
mountPoint = stream.readLine();
mountPoint.remove(" on ");
mountPoint.remove(QRegExp(" type \\w.*")); // Linux
mountPoint.remove(QRegExp(" \\(\\w.*")); // Mac OS X
#else
// Extract the mount point and device name.
stream >> deviceName >> mountPoint;
#endif
stream.readLine(); // skip the rest of the line
#endif

if (deviceName.isNull())
break;
Expand Down

0 comments on commit fc2f0a7

Please sign in to comment.