linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 15/15] kconf: Check for eof from input stream.
@ 2006-01-04 22:01 Ben Collins
  2006-01-08 16:34 ` Roman Zippel
  0 siblings, 1 reply; 22+ messages in thread
From: Ben Collins @ 2006-01-04 22:01 UTC (permalink / raw)
  To: linux-kernel

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

---

 scripts/kconfig/conf.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

62bb36dcb307ca53999a14f74da6a803e36d5f62
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 8ba5d29..10eeae5 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -63,6 +63,20 @@ static void check_stdin(void)
 	}
 }
 
+static char *fgets_check_stream(char *s, int size, FILE *stream)
+{
+	char *ret = fgets(s, size, stream);
+
+	if (ret == NULL && feof(stream)) {
+		printf(_("aborted!\n\n"));
+		printf(_("Console input is closed. "));
+		printf(_("Run 'make oldconfig' to update configuration.\n\n"));
+		exit(1);
+	}
+
+	return ret;
+}
+
 static void conf_askvalue(struct symbol *sym, const char *def)
 {
 	enum symbol_type type = sym_get_type(sym);
@@ -100,7 +114,7 @@ static void conf_askvalue(struct symbol 
 		check_stdin();
 	case ask_all:
 		fflush(stdout);
-		fgets(line, 128, stdin);
+		fgets_check_stream(line, 128, stdin);
 		return;
 	case set_default:
 		printf("%s\n", def);
@@ -356,7 +370,7 @@ static int conf_choice(struct menu *menu
 			check_stdin();
 		case ask_all:
 			fflush(stdout);
-			fgets(line, 128, stdin);
+			fgets_check_stream(line, 128, stdin);
 			strip(line);
 			if (line[0] == '?') {
 				printf("\n%s\n", menu->sym->help ?
-- 
1.0.5

^ permalink raw reply related	[flat|nested] 22+ messages in thread
[parent not found: <5roZI-5y9-29@gated-at.bofh.it>]

end of thread, other threads:[~2006-01-19 12:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04 22:01 [PATCH 15/15] kconf: Check for eof from input stream Ben Collins
2006-01-08 16:34 ` Roman Zippel
2006-01-08 18:53   ` Ben Collins
2006-01-08 20:59     ` Roman Zippel
2006-01-08 21:41       ` Ben Collins
2006-01-09  0:09         ` Roman Zippel
2006-01-09  3:59           ` Ben Collins
2006-01-09 11:32             ` Roman Zippel
2006-01-09 13:42               ` Ben Collins
2006-01-11 23:26                 ` Roman Zippel
2006-01-12  2:00                   ` Ben Collins
2006-01-12 11:08                     ` Roman Zippel
2006-01-12 12:27                       ` Ben Collins
2006-01-12 12:48                         ` Roman Zippel
2006-01-12 13:31                           ` Ben Collins
2006-01-12 14:00                             ` Roman Zippel
2006-01-12 14:16                               ` Ben Collins
2006-01-13 17:44                                 ` Roman Zippel
     [not found] <5roZI-5y9-29@gated-at.bofh.it>
     [not found] ` <5sSVt-5Du-1@gated-at.bofh.it>
     [not found]   ` <5sWwg-2Bq-21@gated-at.bofh.it>
     [not found]     ` <5t4kf-5Px-11@gated-at.bofh.it>
     [not found]       ` <5t5zv-7GD-31@gated-at.bofh.it>
     [not found]         ` <5tXA1-3Lh-35@gated-at.bofh.it>
     [not found]           ` <5u04G-7s6-19@gated-at.bofh.it>
     [not found]             ` <5u8Yt-317-41@gated-at.bofh.it>
     [not found]               ` <5u9L8-4gd-19@gated-at.bofh.it>
     [not found]                 ` <5uadH-4TM-1@gated-at.bofh.it>
     [not found]                   ` <5uaQp-5UL-7@gated-at.bofh.it>
     [not found]                     ` <5ubjI-6KH-21@gated-at.bofh.it>
     [not found]                       ` <5ubtB-6Xy-9@gated-at.bofh.it>
     [not found]                         ` <5uBdT-2Gn-23@gated-at.bofh.it>
2006-01-18 21:51                           ` Bodo Eggert
2006-01-19 11:52                             ` Roman Zippel
2006-01-19 12:50                               ` Bodo Eggert
2006-01-19 12:55                                 ` Roman Zippel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).