diff mbox

[190/190] kbuild: fix unused return value from fgets()

Message ID 1274748661-15253-4-git-send-email-ben-linux@fluff.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Dooks May 25, 2010, 12:51 a.m. UTC
None
diff mbox

Patch

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 9960d1c..83c5e24 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -78,6 +78,7 @@  static void check_stdin(void)
 static int conf_askvalue(struct symbol *sym, const char *def)
 {
 	enum symbol_type type = sym_get_type(sym);
+	char *r;
 
 	if (!sym_has_value(sym))
 		printf(_("(NEW) "));
@@ -102,7 +103,9 @@  static int conf_askvalue(struct symbol *sym, const char *def)
 		check_stdin();
 	case ask_all:
 		fflush(stdout);
-		fgets(line, 128, stdin);
+		r = fgets(line, 128, stdin);
+		if (!r)
+			line[0] = '\0';
 		return 1;
 	default:
 		break;
@@ -259,6 +262,7 @@  static int conf_choice(struct menu *menu)
 
 	while (1) {
 		int cnt, def;
+		char *r;
 
 		printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
 		def_sym = sym_get_choice_value(sym);
@@ -304,7 +308,9 @@  static int conf_choice(struct menu *menu)
 			check_stdin();
 		case ask_all:
 			fflush(stdout);
-			fgets(line, 128, stdin);
+			r = fgets(line, 128, stdin);
+			if (!r)
+				line[0] = '\0';
 			strip(line);
 			if (line[0] == '?') {
 				print_help(menu);