From: Wolfgang Bumiller Date: Mon, 7 Sep 2015 10:09:27 +0000 (+0200) Subject: is_mounted: use realpath on the mountpoint X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=inline;h=11ade4ad4580048bf7abea4cd9d0e5811ddb956d;p=pve-common.git is_mounted: use realpath on the mountpoint This will avoid problmes with symlinks as well as paths containing ./, ../ or trailing slashes. --- diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm index 4670694..368ae73 100644 --- a/src/PVE/ProcFSTools.pm +++ b/src/PVE/ProcFSTools.pm @@ -6,6 +6,7 @@ use POSIX; use Time::HiRes qw (gettimeofday); use IO::File; use PVE::Tools; +use Cwd; my $clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK); @@ -291,6 +292,8 @@ sub read_proc_mounts { sub is_mounted { my ($mountpoint) = @_; + $mountpoint = Cwd::realpath($mountpoint); + my $mountdata = read_proc_mounts(); if ($mountdata =~ m/\s$mountpoint\s/) {