Skip to content

Commit

Permalink
checkpolicy: include <ctype.h> for isprint(3)
Browse files Browse the repository at this point in the history
Include the necessary header for isprint(3) to avoid an implicit
function declaration:

    policy_scan.l: In function ‘yyerror’:
    policy_scan.l:342:13: warning: implicit declaration of function ‘isprint’ [-Wimplicit-function-declaration]
      342 |         if (isprint((unsigned char)yytext[0])) {
          |             ^~~~~~~
    policy_scan.l:36:1: note: include ‘<ctype.h>’ or provide a declaration of ‘isprint’
       35 | #include "y.tab.h"
      +++ |+#include <ctype.h>
       36 | #endif

This does not currently break the build cause -Werror is stripped for
the parsing code to avoid breakage on old flex/bison versions that might
not generate warning free code.

Fixes: 39b3cc5 ("checkpolicy: handle unprintable token")
Signed-off-by: Christian Göttsche <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Apr 4, 2024
1 parent c071aa2 commit 0ffe974
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions checkpolicy/policy_scan.l
Expand Up @@ -22,6 +22,7 @@

%{
#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
#include <stdint.h>
#include <string.h>
Expand Down

0 comments on commit 0ffe974

Please sign in to comment.