diff mbox series

[3/4] dispol: handle EOF in user interaction

Message ID 20230608015241.2454912-3-yamato@redhat.com (mailing list archive)
State Accepted
Commit f8a076f1cada
Headers show
Series [1/4] dispol: add --help option | expand

Commit Message

Masatake YAMATO June 8, 2023, 1:52 a.m. UTC
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 checkpolicy/test/dispol.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c
index e0748e90..e1f6d7fc 100644
--- a/checkpolicy/test/dispol.c
+++ b/checkpolicy/test/dispol.c
@@ -531,6 +531,8 @@  int main(int argc, char **argv)
 	for (;;) {
 		printf("\nCommand (\'m\' for menu):  ");
 		if (fgets(ans, sizeof(ans), stdin) == NULL) {
+			if (feof(stdin))
+				break;
 			fprintf(stderr, "fgets failed at line %d: %s\n", __LINE__,
 					strerror(errno));
 			continue;