From 11ade4ad4580048bf7abea4cd9d0e5811ddb956d Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 7 Sep 2015 12:09:27 +0200 Subject: [PATCH] is_mounted: use realpath on the mountpoint This will avoid problmes with symlinks as well as paths containing ./, ../ or trailing slashes. --- src/PVE/ProcFSTools.pm | 3 +++ 1 file changed, 3 insertions(+) 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/) { -- 2.39.2