]> granicus.if.org Git - apache/commitdiff
Properly log flex fatal errors and abort(), instead of the
authorStefan Fritsch <sf@apache.org>
Mon, 5 Nov 2012 12:39:03 +0000 (12:39 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 5 Nov 2012 12:39:03 +0000 (12:39 +0000)
default of fprintf(stderr, ...) and exit(2)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1405770 13f79535-47bb-0310-9956-ffa450edef68

server/util_expr_scan.l

index 513236a940a7861e7c4741fea687cd27689deb4c..c75b3744d849446b0fef8638dcdeeb5efa126b53 100644 (file)
@@ -42,6 +42,8 @@
 %{
 #include "util_expr_private.h"
 #include "util_expr_parse.h"
+#include "http_main.h"
+#include "http_log.h"
 
 #undef  YY_INPUT
 #define YY_INPUT(buf,result,max_size)                       \
     }                                                       \
 }
 
+/*
+ * XXX: It would be nice if we could recover somehow, e.g. via
+ * XXX: longjmp. It is not clear if the scanner is in any state
+ * XXX: to be cleaned up, though.
+ */
+#define YY_FATAL_ERROR(msg)                                     \
+    do {                                                        \
+        ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, \
+                      "expr parser fatal error (BUG?): "        \
+                      "%s, exiting", msg);                      \
+         abort();                                               \
+    } while (0)
+
 #define YY_EXTRA_TYPE ap_expr_parse_ctx_t*
 
 #define PERROR(msg) do { yyextra->error2 = msg ; return T_ERROR; } while (0)