From 7fc619d5d31c2eba2cfab6f1fcf6cb9dca7ddf55 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 14 Feb 2013 06:53:48 +0100 Subject: [PATCH] use File::chdir instead of Cwd To avoid errors in taint mode. --- PVE/Storage/Plugin.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index de2818c..462d9e1 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -2,7 +2,7 @@ package PVE::Storage::Plugin; use strict; use warnings; -use Cwd; +use File::chdir; use File::Path; use PVE::Tools qw(run_command); use PVE::JSONSchema qw(get_standard_option); @@ -506,10 +506,9 @@ sub clone_image { my $path = $class->path($scfg, $newvol); - # Note: we use relative paths, so we need to call chdir before qemu-img - my $oldcwd = cwd(); + # Note: we use relative paths, so we need to call chdir before qemu-img eval { - chdir $imagedir; + local $CWD = $imagedir; my $cmd = ['/usr/bin/qemu-img', 'create', '-b', "../$basevmid/$basename", '-f', 'qcow2', $path]; @@ -518,8 +517,6 @@ sub clone_image { }; my $err = $@; - chdir $oldcwd; - die $err if $err; return $newvol;