Error in /usr/src/sbin/setkey

Unga unga888 at yahoo.com
Sun Jun 29 08:13:15 UTC 2008


--- On Sat, 6/28/08, Unga <unga888 at yahoo.com> wrote:

> From: Unga <unga888 at yahoo.com>
> Subject: Error in /usr/src/sbin/setkey
> To: freebsd-questions at freebsd.org
> Date: Saturday, June 28, 2008, 9:15 PM
> Hi all
> 
> I made a separate make in /usr/src/sbin, I get a error in
> /usr/src/sbin/setkey as follows:
> ===> setkey (all)
> yacc -d /usr/src/sbin/setkey/parse.y
> cp y.tab.c parse.c
> cc -O2 -fno-strict-aliasing -pipe  -I/usr/src/sbin/setkey
> -I/usr/src/sbin/setkey
> /../../lib/libipsec
> -I/usr/src/sbin/setkey/../../lib/libipsec
> -I/usr/src/sbin/se
> tkey/../../sys/netipsec -DIPSEC_DEBUG -DYY_NO_UNPUT -DINET6
> -I. -Wsystem-headers
>  -Wno-pointer-sign -c /usr/src/sbin/setkey/setkey.c
> cc -O2 -fno-strict-aliasing -pipe  -I/usr/src/sbin/setkey
> -I/usr/src/sbin/setkey
> /../../lib/libipsec
> -I/usr/src/sbin/setkey/../../lib/libipsec
> -I/usr/src/sbin/se
> tkey/../../sys/netipsec -DIPSEC_DEBUG -DYY_NO_UNPUT -DINET6
> -I. -Wsystem-headers
>  -Wno-pointer-sign -c parse.c
> lex -t  /usr/src/sbin/setkey/token.l > token.c
> cc -O2 -fno-strict-aliasing -pipe  -I/usr/src/sbin/setkey
> -I/usr/src/sbin/setkey
> /../../lib/libipsec
> -I/usr/src/sbin/setkey/../../lib/libipsec
> -I/usr/src/sbin/se
> tkey/../../sys/netipsec -DIPSEC_DEBUG -DYY_NO_UNPUT -DINET6
> -I. -Wsystem-headers
>  -Wno-pointer-sign -c token.c
> /usr/src/sbin/setkey/token.l: In function 'yylex':
> /usr/src/sbin/setkey/token.l:226: error: lvalue required as
> increment operand
> *** Error code 1
> 
> Stop in /usr/src/sbin/setkey.
> *** Error code 1
> 
> Stop in /usr/src/sbin.
> 
> 

I have narrow down the issue. The issue is with /usr/src/sbin/setkey/token.l .

The relevant section from token.l:
{quotedstring}	{
			char *p = yytext;
			while (*++p != '"') ;
			*p = '\0';
			yytext++;
			yylval.val.len = yyleng - 2;
			yylval.val.buf = strdup(yytext);
			if (!yylval.val.buf)
				yyfatal("insufficient memory");

			return(QUOTEDSTRING);
		}

The variable yytext is declared as follows inside the token.c:
extern char yytext[];

But the variable yytext is not declared in any file in /usr/src/sbin/setkey/.

Comment out "yytext++;" line cleanly compiles the token.c.

Similar use of token.l is there in /usr/src/sbin/devd/. The variable yytext is used but no increment operator is used on it and it is also not declared in any file in /usr/src/sbin/devd/, but that token.c get cleanly compiles.

Is it an error/mistake to have an "yytext++;" line inside token.l? What should be the correct fix for this?

KInd regards
Unga



      


More information about the freebsd-questions mailing list