flowwatch causes flex to die

From: Goncalo Costa (goncalo.costa@kpnqwest.pt)
Date: Mon Mar 05 2001 - 09:07:51 PST

  • Next message: Jeffrey Papen: "Want cflowd to only write raw flows from plonka's patch"

    Hello.

    I'm running a few flowwatches and piping their output to a flex
    generated
    program to process the data. That is, I invoke flowwatch like this

    bash-2.03$ flowwatch <filter> | mytool &

    where mytool was compiled from lex.yy.c, which in turn was generated
    from
    a lex source file.

    This is working fine except for some cases in which the filter causes
    flowwtach to generate very few output.

    In these cases mytool dies (no core dump) and all I get is the message
    "input in flex scanner failed" to the screen.

    I've seen http://compilers.iecc.com/comparch/article/99-05-049 .

    And I checked lex.yy.c and the only place where this message can be
    written is:

    /* Gets input and stuffs it into "buf". number of characters read, or
    YY_NULL,
     * is returned in "result".
     */
    #ifndef YY_INPUT
    #define YY_INPUT(buf,result,max_size) \
            if ( yy_current_buffer->yy_is_interactive ) \
                    { \
                    int c = '*', n; \
                    for ( n = 0; n < max_size && \
                                 (c = getc( yyin )) != EOF && c != '\n'; ++n
    ) \
                            buf[n] = (char) c; \
                    if ( c == '\n' ) \
                            buf[n++] = (char) c; \
                    if ( c == EOF && ferror( yyin ) ) \
                            YY_FATAL_ERROR( "input in flex scanner failed"
    ); \
                    result = n; \
                    } \
            else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
                      && ferror( yyin ) ) \
                    YY_FATAL_ERROR( "input in flex scanner failed" );
    #endif

    So for the message to happen, ferror( yyin) must be non zero.
    Does anyone know why is this so ??

    Thank you
    Goncalo

    --
    cflowd mailing list
    cflowd@caida.org
    



    This archive was generated by hypermail 2b29 : Mon Mar 05 2001 - 09:21:02 PST