[PATCH 11/15] libtracefs: my_yyinput() should return 0 when no data can be read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



YY_INPUT() is redefined in sqlhist.l and basically just call
my_yyinput() to do the work. However, YY_INPUT is supposed to return
YY_NULL (0 on Unix system) when no data can be read, not -1. This can
cause an overflow error in the generated sqlhist-lex.c file.

Have my_yyinput() returns zero when no buffer is found.

Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx>
---
 src/tracefs-sqlhist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index c7b9eff..0f678c1 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -121,7 +121,7 @@ __hidden int my_yyinput(void *extra, char *buf, int max)
 	struct sqlhist_bison *sb = extra;
 
 	if (!sb || !sb->buffer)
-		return -1;
+		return 0;
 
 	if (sb->buffer_idx + max > sb->buffer_size)
 		max = sb->buffer_size - sb->buffer_idx;
-- 
2.44.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux