All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masatake YAMATO <yamato@redhat.com>
To: selinux@vger.kernel.org
Cc: yamato@redhat.com
Subject: [PATCH 3/4] dismod: handle EOF in user interaction
Date: Wed, 31 May 2023 10:32:23 +0900	[thread overview]
Message-ID: <20230531013224.1135775-3-yamato@redhat.com> (raw)
In-Reply-To: <20230531013224.1135775-1-yamato@redhat.com>

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 checkpolicy/test/dismod.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index f1b879b0..3b81b1ce 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -921,6 +921,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;
-- 
2.40.1


  parent reply	other threads:[~2023-05-31  1:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  1:32 [PATCH 1/4] dismod: add --help option Masatake YAMATO
2023-05-31  1:32 ` [PATCH 2/4] dismod: delete an unnecessary empty line Masatake YAMATO
2023-05-31  1:32 ` Masatake YAMATO [this message]
2023-05-31  1:32 ` [PATCH 4/4] dismod: add --actions option for non-interactive use Masatake YAMATO
2023-06-07 13:22 ` [PATCH 1/4] dismod: add --help option James Carter
2023-06-08  1:45   ` Masatake YAMATO
2023-06-08 19:50   ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531013224.1135775-3-yamato@redhat.com \
    --to=yamato@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.