]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Override umask so that we are sure things will be world readable.
[remoteglot] / remoteglot.pl
index c35a0518694789ad9c37452599226fd65977033a..167fb21bc0d16617f01836f17eab1d23ae8b0f14 100755 (executable)
@@ -67,6 +67,7 @@ select(TBLOG);
 $| = 1;
 
 select(STDOUT);
+umask 0022;
 
 # open the chess engine
 my $engine = open_engine($remoteglotconf::engine_cmdline, 'E1', sub { handle_uci(@_, 1); });
@@ -275,8 +276,12 @@ sub handle_pgn {
        }
 
        my $pgn = Chess::PGN::Parse->new(undef, $body);
-       if (!defined($pgn) || !$pgn->read_game() || $body !~ /^\[/) {
-               warn "Error in parsing PGN from $url\n";
+       if (!defined($pgn)) {
+               warn "Error in parsing PGN from $url [body='$body']\n";
+       } elsif (!$pgn->read_game()) {
+               warn "Error in reading PGN game from $url [body='$body']\n";
+       } elsif ($body !~ /^\[/) {
+               warn "Malformed PGN from $url [body='$body']\n";
        } else {
                eval {
                        # Skip to the right game.