Skip to contentSkip to conversation

secilc/secil2tree: Test for stdout rather than stdin

PATCH In review James Carter 2 participants 3 messages Jun 4 – Jun 5 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 secilc/secil2tree: Test for stdout rather than stdin

When exiting there was a check "file != stdin" to avoid calling fclose on it, but that check should have been for stdout.

Check that file is not pointing to stdout before closing it.

---
 secilc/secil2tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
secilc/secil2tree.c +1 -1
index aae5f998..dc12490d 100644
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
 	}
 
 exit:
-	if (file != NULL && file != stdin) {
+	if (file != NULL && file != stdout) {
 		fclose(file);
 	}
 	free(buffer);
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · James Carter

When exiting there was a check "file != stdin" to avoid calling fclose on it, but that check should have been for stdout.

Check that file is not pointing to stdout before closing it.

Quoted 21 lines
---
 secilc/secil2tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
secilc/secil2tree.c +1 -2
index aae5f998..dc12490d 100644
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
        }
 
 exit:
-       if (file != NULL && file != stdin) {
+       if (file != NULL && file != stdout) {
                fclose(file);
        }
        free(buffer);
--

2.54.0

#2 lore raw
Quoted 12 lines · Stephen Smalley
Quoted 7 lines · James Carter

When exiting there was a check "file != stdin" to avoid calling fclose on it, but that check should have been for stdout.

Check that file is not pointing to stdout before closing it.

Merged.
Jim

Quoted 21 lines
Quoted 21 lines
---
 secilc/secil2tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
secilc/secil2tree.c +1 -2
index aae5f998..dc12490d 100644
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
        }
 
 exit:
-       if (file != NULL && file != stdin) {
+       if (file != NULL && file != stdout) {
                fclose(file);
        }
        free(buffer);
--

2.54.0