From 79e7724930d49cc8cdac4c7d4e80b1fafd22d1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 6 Jul 2021 19:54:26 +0200 Subject: [PATCH] checkpolicy: follow declaration-after-statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the project style of no declaration after statement. Found by the GCC warning -Wdeclaration-after-statement. Signed-off-by: Christian Göttsche --- checkpolicy/checkmodule.c | 6 ++++-- checkpolicy/policy_define.c | 3 ++- checkpolicy/test/dismod.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/checkpolicy/checkmodule.c b/checkpolicy/checkmodule.c index 40d0ec9924e9..316b289865e1 100644 --- a/checkpolicy/checkmodule.c +++ b/checkpolicy/checkmodule.c @@ -288,14 +288,16 @@ int main(int argc, char **argv) } if (policy_type != POLICY_BASE && outfile) { + char *out_name; + char *separator; char *mod_name = modpolicydb.name; char *out_path = strdup(outfile); if (out_path == NULL) { fprintf(stderr, "%s: out of memory\n", argv[0]); exit(1); } - char *out_name = basename(out_path); - char *separator = strrchr(out_name, '.'); + out_name = basename(out_path); + separator = strrchr(out_name, '.'); if (separator) { *separator = '\0'; } diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c index 7eff747adacf..049df55f8468 100644 --- a/checkpolicy/policy_define.c +++ b/checkpolicy/policy_define.c @@ -1904,9 +1904,10 @@ int avrule_read_ioctls(struct av_ioctl_range_list **rangehead) { char *id; struct av_ioctl_range_list *rnew, *r = NULL; - *rangehead = NULL; uint8_t omit = 0; + *rangehead = NULL; + /* read in all the ioctl commands */ while ((id = queue_remove(id_queue))) { if (strcmp(id,"~") == 0) { diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c index fadbc8d16695..b1b96115e79e 100644 --- a/checkpolicy/test/dismod.c +++ b/checkpolicy/test/dismod.c @@ -697,8 +697,8 @@ int display_avblock(int field, policydb_t * policy, { avrule_block_t *block = policydb.global; while (block != NULL) { - fprintf(out_fp, "--- begin avrule block ---\n"); avrule_decl_t *decl = block->branch_list; + fprintf(out_fp, "--- begin avrule block ---\n"); while (decl != NULL) { if (display_avdecl(decl, field, policy, out_fp)) { return -1; -- 2.32.0