[apparmor] PATCH [3/6] - allow error= field to return negative error codes

John Johansen john.johansen at canonical.com
Thu Sep 9 16:36:32 BST 2010


The kernel can return negative error codes for error=

Index: libapparmor/src/grammar.y
===================================================================
--- libapparmor.orig/src/grammar.y	2010-09-09 07:56:50.534193401 -0700
+++ libapparmor/src/grammar.y	2010-09-09 07:59:37.364193121 -0700
@@ -92,6 +92,7 @@
 
 %token TOK_EQUALS
 %token TOK_COLON
+%token TOK_MINUS
 %token TOK_OPEN_PAREN
 %token TOK_CLOSE_PAREN
 %token TOK_PERIOD
@@ -434,6 +435,8 @@
 	{ ret_record->event = lookup_aa_event($3);}
 	| TOK_KEY_ERROR TOK_EQUALS TOK_DIGITS
 	{ ret_record->error_code = $3;}
+	| TOK_KEY_ERROR TOK_EQUALS TOK_MINUS TOK_DIGITS
+	{ ret_record->error_code = $4;}
 	| TOK_KEY_FSUID TOK_EQUALS TOK_DIGITS
 	{ ret_record->fsuid = $3;}
 	| TOK_KEY_OUID TOK_EQUALS TOK_DIGITS
Index: libapparmor/src/scanner.l
===================================================================
--- libapparmor.orig/src/scanner.l	2010-09-09 07:56:45.844193401 -0700
+++ libapparmor/src/scanner.l	2010-09-09 07:59:18.614191984 -0700
@@ -77,6 +77,7 @@
 digits		[0-9]+
 hex		[A-F0-9]
 colon		":"
+minus		"-"
 open_paren	"("
 close_paren	")"
 ID		[^ \t\n\(\)="'!]
@@ -280,6 +281,7 @@
 {equals}		{ return(TOK_EQUALS); }
 {digits}		{ yylval->t_long = atol(yytext); return(TOK_DIGITS); }
 {colon}			{ return(TOK_COLON); }
+{minus}			{ return(TOK_MINUS); }
 {open_paren}		{
 			BEGIN(sub_id);
 			return(TOK_OPEN_PAREN);



More information about the AppArmor mailing list