do not call fprintf from yyerror in expression parser
authorStephen M. Cameron <stephenmcameron@gmail.com>
Tue, 30 Sep 2014 14:31:04 +0000 (09:31 -0500)
committerJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 16:41:46 +0000 (10:41 -0600)
Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
exp/expression-parser.y
exp/test-expression-parser.c

index 6ab6408874b829d2dffbf0ed6fa82ebc9558414d..87ead8ac5d9fef8d0fa2172f2b7410c67b13a6f7 100644 (file)
@@ -229,9 +229,10 @@ int evaluate_arithmetic_expression(const char *buffer, long long *ival, double *
 int yyerror(__attribute__((unused)) long long *result,
                __attribute__((unused)) double *dresult,
                __attribute__((unused)) int *has_error,
-               __attribute__((unused)) int *bye, const char *msg)
+               __attribute__((unused)) int *bye,
+               __attribute__((unused)) const char *msg)
 {
-       fprintf(stderr, "%s\n", msg);
+       /* We do not need to do anything here. */
        return 0;
 }
 
index 022df0111deb2f506210aacf98de5e0d14f2a77c..45151442378392111168b6c277fbe720ca0b169d 100644 (file)
@@ -44,6 +44,7 @@ int main(int argc, char *argv[])
                if (!rc) {
                        printf("%lld (%20.20lf)\n", result, dresult);
                } else {
+                       fprintf(stderr, "Syntax error\n");
                        result = 0;
                        dresult = 0;
                }