]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
test commit
[ikiwiki.git] / IkiWiki.pm
index d949566d834fb1cfcc053bd48ae91398f2571e80..735dc97b14f32dce588410e00b9063342054a668 100644 (file)
@@ -721,6 +721,10 @@ sub readfile ($;$$) { #{{{
        binmode($in) if ($binary);
        return \*$in if $wantfd;
        my $ret=<$in>;
+       # check for invalid utf-8, and toss it back to avoid crashes
+       if (! utf8::valid($ret)) {
+               $ret=encode_utf8($ret);
+       }
        close $in || error("failed to read $file: $!");
        return $ret;
 } #}}}
@@ -1295,6 +1299,7 @@ sub lockwiki () { #{{{
 } #}}}
 
 sub unlockwiki () { #{{{
+       POSIX::close($ENV{IKIWIKI_CGILOCK_FD}) if exists $ENV{IKIWIKI_CGILOCK_FD};
        return close($wikilock) if $wikilock;
        return;
 } #}}}