From: Jamie Cameron Date: Wed, 19 Oct 2011 04:52:45 +0000 (-0700) Subject: Fix call to open_lock_tempfile on a symlink X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=webmin.git;a=commitdiff_plain;h=91000e53fc5fd82ac9f6bee34fd9fc118d943f5e Fix call to open_lock_tempfile on a symlink --- diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index aca631ea..16a2a523 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -8428,6 +8428,11 @@ $fh = &callers_package($fh); my $lockfile = $file; $lockfile =~ s/^[^\/]*//; if ($lockfile =~ /^\//) { + while(-l $lockfile) { + # If the file is a link, follow it so that locking is done on + # the same file that gets unlocked later + $lockfile = &resolve_links($lockfile); + } $main::open_templocks{$lockfile} = &lock_file($lockfile); } return &open_tempfile($fh, $file, $noerror, $notemp, $safe);