dispol: handle EOF in user interaction

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Masatake YAMATO 2023-06-08 10:52:40 +09:00 committed by James Carter
parent eeb0a75119
commit f8a076f1ca

View File

@ -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;