diff options
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r-- | scripts/kconfig/conf.c | 15 |
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) | |||
108 | check_stdin(); | 108 | check_stdin(); |
109 | case oldaskconfig: | 109 | case oldaskconfig: |
110 | fflush(stdout); | 110 | fflush(stdout); |
111 | fgets(line, 128, stdin); | 111 | xfgets(line, 128, stdin); |
112 | return 1; | 112 | return 1; |
113 | default: | 113 | default: |
114 | break; | 114 | break; |
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu) | |||
306 | check_stdin(); | 306 | check_stdin(); |
307 | case oldaskconfig: | 307 | case oldaskconfig: |
308 | fflush(stdout); | 308 | fflush(stdout); |
309 | fgets(line, 128, stdin); | 309 | xfgets(line, 128, stdin); |
310 | strip(line); | 310 | strip(line); |
311 | if (line[0] == '?') { | 311 | if (line[0] == '?') { |
312 | print_help(menu); | 312 | print_help(menu); |
@@ -644,3 +644,14 @@ int main(int ac, char **av) | |||
644 | } | 644 | } |
645 | return 0; | 645 | return 0; |
646 | } | 646 | } |
647 | /* | ||
648 | * Helper function to facilitate fgets() by Jean Sacren. | ||
649 | */ | ||
650 | void xfgets(str, size, in) | ||
651 | char *str; | ||
652 | int size; | ||
653 | FILE *in; | ||
654 | { | ||
655 | if (fgets(str, size, in) == NULL) | ||
656 | fprintf(stderr, "\nError in reading or end of file.\n"); | ||
657 | } | ||