diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-03-09 13:32:07 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-03-13 13:58:45 +0100 |
commit | 79bde56ea93b396e509fff0ad7a490f949aa5aa4 (patch) | |
tree | 85fb0238b7aab59153eb59022a19351957b46c0e /apt-pkg | |
parent | 1e071c30340ef6b0f8279440a9fd369f27e9b34b (diff) |
if mountpoint has a ".disk" directory it is mounted
Checking that parent-directory of mountpoint and mountpoint are on
different devices is fine most of the time, but is too restrictive
for our testcases and there shouldn't be anything wrong with 'normal'
users copying disk-contents around either if they want to.
We check for the existance of the ".disk/" directory now as this will
not be present if the disk isn't 'mounted'. Disks doesn't need to have
such a directory through, so for those we fall back to the old way of
detecting mounted or not mounted.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/cdromutl.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 096d3bcf5..176cc2024 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -45,11 +45,16 @@ bool IsMounted(string &Path) { if (Path.empty() == true) return false; - + // Need that trailing slash for directories if (Path[Path.length() - 1] != '/') Path += '/'; - + + // if the path has a ".disk" directory we treat it as mounted + // this way even extracted copies of disks are recognized + if (DirectoryExists(Path + ".disk/") == true) + return true; + /* First we check if the path is actually mounted, we do this by stating the path and the previous directory (careful of links!) and comparing their device fields. */ |