Skip to content
Snippets Groups Projects
Commit 47c14611 authored by William Roberts's avatar William Roberts Committed by William Roberts
Browse files

Fix sepolicy-analyze build with different toolchains

host C: sepolicy-analyze <= external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c
external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c: In function 'usage':
external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c:30:5: error: 'for' loop initial declarations are only allowed in C99 mode
external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c:30:5: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [out/host/linux-x86/obj/EXECUTABLES/sepolicy-analyze_intermediates/sepolicy-analyze.o] Error 1

Change-Id: I9222e447b032d051c251c9718e2b8d5ffb9e9c35
parent c48971f6
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,11 @@ static struct {
void usage(char *arg0)
{
int i;
fprintf(stderr, "%s must be called on a policy file with a component and the appropriate arguments specified\n", arg0);
fprintf(stderr, "%s <policy-file>:\n", arg0);
for(int i = 0; i < NUM_COMPONENTS; i++) {
for(i = 0; i < NUM_COMPONENTS; i++) {
analyze_components[i].usage();
}
exit(1);
......@@ -39,12 +41,14 @@ int main(int argc, char **argv)
struct policy_file pf;
policydb_t policydb;
int rc;
int i;
if (argc < 3)
usage(argv[0]);
policy = argv[1];
if(load_policy(policy, &policydb, &pf))
exit(1);
for(int i = 0; i < NUM_COMPONENTS; i++) {
for(i = 0; i < NUM_COMPONENTS; i++) {
if (!strcmp(analyze_components[i].key, argv[2])) {
rc = analyze_components[i].func(argc - 2, argv + 2, &policydb);
if (rc && USAGE_ERROR) {
......@@ -53,4 +57,5 @@ int main(int argc, char **argv)
}
}
usage(argv[0]);
exit(0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment