summary refs log tree commit diff
path: root/scripts/kconfig/conf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-13 17:56:27 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-13 17:56:27 -0700
commit090b710e8a0b7fe6f4752c5a439261f955075ebc (patch)
treec85856f2955c3b0795db2c30ef0b334c0614e326 /scripts/kconfig/conf.c
parent10041d2d14688e207d0d829095147aa82c1f211b (diff)
parent4418a2b904805814bbd14b555d6add6a175f49f3 (diff)
downloadlinux-090b710e8a0b7fe6f4752c5a439261f955075ebc.tar.gz
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  kconfig: Fix warning: ignoring return value of 'fgets'
  kconfig: Fix warning: ignoring return value of 'fwrite'
  nconfig: Fix segfault when menu is empty
  kconfig: fix tristate choice with minimal config
  kconfig: fix savedefconfig for tristate choices
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r--scripts/kconfig/conf.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 274f2716b03e..5b7c86ea43a1 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
 		check_stdin();
 	case oldaskconfig:
 		fflush(stdout);
-		fgets(line, 128, stdin);
+		xfgets(line, 128, stdin);
 		return 1;
 	default:
 		break;
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu)
 			check_stdin();
 		case oldaskconfig:
 			fflush(stdout);
-			fgets(line, 128, stdin);
+			xfgets(line, 128, stdin);
 			strip(line);
 			if (line[0] == '?') {
 				print_help(menu);
@@ -644,3 +644,14 @@ int main(int ac, char **av)
 	}
 	return 0;
 }
+/*
+ * Helper function to facilitate fgets() by Jean Sacren.
+ */
+void xfgets(str, size, in)
+	char *str;
+	int size;
+	FILE *in;
+{
+	if (fgets(str, size, in) == NULL)
+		fprintf(stderr, "\nError in reading or end of file.\n");
+}