]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/editpage.pm
protect $@ whenever a block using $@ is non-trivial
[ikiwiki.git] / IkiWiki / Plugin / editpage.pm
index d15607990db2412b8a14f281864f82f98b3cac7f..3047869c4a0ad4da75f715937b8fff185dc80970 100644 (file)
@@ -400,10 +400,12 @@ sub cgi_editpage ($$) {
                eval { writefile($file, $config{srcdir}, $content) };
                $config{cgi}=1;
                if ($@) {
+                       # save $@ in case a called function clobbers it
+                       my $error = $@;
                        $form->field(name => "rcsinfo", value => rcs_prepedit($file),
                                force => 1);
                        my $mtemplate=template("editfailedsave.tmpl");
-                       $mtemplate->param(error_message => $@);
+                       $mtemplate->param(error_message => $error);
                        $form->tmpl_param("message", $mtemplate->output);
                        $form->field("editcontent", value => $content, force => 1);
                        $form->tmpl_param("page_select", 0);