chiark / gitweb /
pubkeys: Better debug logging for syntax errors
[secnet.git] / pubkeys.fl.pl
index f0e8d58c3364f7702117635a009377e1a96080b1..43df2e16593cff2bfeda6ae9cec81cbd2d2c71bf 100755 (executable)
@@ -134,6 +134,7 @@ L   [ \t]*
 S      [ \t]+
 BASE91S        []-~!#-&(-[]+
 %x SKIPNL
+%x SYNTAXERR
 
 %option yylineno
 %option noyywrap
@@ -267,7 +268,14 @@ static struct pubkeyset_context c[1];
 
 <INITIAL><<EOF>>       { return 0; }
 
-<*>. { FAIL("syntax error"); }
+<*>. {
+    yymore();
+    BEGIN(SYNTAXERR);
+}
+<SYNTAXERR>.* {
+    slilog(LI,M_DEBUG,"pubkeys syntax error at `%s'", yytext);
+    FAIL("syntax error");
+}
 <*>\n { FAIL("syntax error - unexpected newline"); }
 <<EOF>> { FAIL("syntax error - unexpected eof"); }
 
@@ -283,7 +291,8 @@ keyset_load(const char *path, struct buffer_if *data_buf,
     if (!pkyyin) {
        slilog(LI,
               errno==ENOENT ? logcl_enoent : M_ERR,
-              "could not open keyset file %s: %s",
+              "%scould not open keyset file %s: %s",
+              logcl_enoent==M_DEBUG && errno==ENOENT ? "expectedly " : "",
               path,strerror(errno));
        goto err;
     }