summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm10
-rw-r--r--IkiWiki/Plugin/img.pm2
-rw-r--r--IkiWiki/Render.pm12
3 files changed, 19 insertions, 5 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 6770f6feb..d805506aa 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -750,4 +750,14 @@ sub cgi (;$$) { #{{{
}
} #}}}
+# Does not need tobe called directly; all errors will go through here.
+sub cgierror ($) { #{{{
+ my $message=shift;
+
+ print "Content-type: text/html\n\n";
+ print misctemplate(gettext("Error"),
+ "<p class=\"error\">".gettext("Error").": $message</p>");
+ die $@;
+} #}}}
+
1
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index cc0e84b01..49e1d57d6 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -46,7 +46,7 @@ sub preprocess (@) { #{{{
my $base = IkiWiki::basename($file);
eval q{use Image::Magick};
- error($@) if $@;
+ return "[[img ".gettext("Image::Magick not installed")."]]" if $@;
my $im = Image::Magick->new;
my $imglink;
my $r;
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index c241fd40b..990fcaaa1 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -229,10 +229,14 @@ sub render ($) { #{{{
will_render($file, $file, 1);
if ($config{hardlink}) {
- prep_writefile($file, $config{destdir});
- unlink($config{destdir}."/".$file);
- if (link($srcfile, $config{destdir}."/".$file)) {
- return;
+ # only hardlink if owned by same user
+ my @stat=stat($srcfile);
+ if ($stat[4] == $>) {
+ prep_writefile($file, $config{destdir});
+ unlink($config{destdir}."/".$file);
+ if (link($srcfile, $config{destdir}."/".$file)) {
+ return;
+ }
}
# if hardlink fails, fall back to copying
}