All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] checkpolicy: remove a redundant if-condition
@ 2019-10-19 10:26 Masatake YAMATO
  2019-10-19 10:26 ` [PATCH v2 2/3] checkpolicy: update the description for -o option in the man page Masatake YAMATO
  2019-10-19 10:26 ` [PATCH v2 3/3] checkpolicy: allow to write policy to stdout Masatake YAMATO
  0 siblings, 2 replies; 4+ messages in thread
From: Masatake YAMATO @ 2019-10-19 10:26 UTC (permalink / raw)
  To: selinux; +Cc: yamato

Inner if-condition in following code is redundant:

	if (outfile) {
		/* ... just referring outfile ... */
		if (outfile) {
			do_something();
		}
	}

We can simplify this to:

	if (outfile) {
		/* ... just referring outfile ... */
		do_something();
	}

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 checkpolicy/checkpolicy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/checkpolicy/checkpolicy.c b/checkpolicy/checkpolicy.c
index f928ec06..e18de171 100644
--- a/checkpolicy/checkpolicy.c
+++ b/checkpolicy/checkpolicy.c
@@ -682,9 +682,7 @@ int main(int argc, char **argv)
 			}
 		}
 
-		if (outfile) {
-			fclose(outfp);
-		}
+		fclose(outfp);
 	} else if (cil) {
 		fprintf(stderr, "%s:  No file to write CIL was specified\n", argv[0]);
 		exit(1);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-22 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19 10:26 [PATCH v2 1/3] checkpolicy: remove a redundant if-condition Masatake YAMATO
2019-10-19 10:26 ` [PATCH v2 2/3] checkpolicy: update the description for -o option in the man page Masatake YAMATO
2019-10-19 10:26 ` [PATCH v2 3/3] checkpolicy: allow to write policy to stdout Masatake YAMATO
2019-10-22 12:27   ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.