Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[pandora-kernel.git] / scripts / kconfig / conf.c
index 274f271..5b7c86e 100644 (file)
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
                check_stdin();
        case oldaskconfig:
                fflush(stdout);
                check_stdin();
        case oldaskconfig:
                fflush(stdout);
-               fgets(line, 128, stdin);
+               xfgets(line, 128, stdin);
                return 1;
        default:
                break;
                return 1;
        default:
                break;
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu)
                        check_stdin();
                case oldaskconfig:
                        fflush(stdout);
                        check_stdin();
                case oldaskconfig:
                        fflush(stdout);
-                       fgets(line, 128, stdin);
+                       xfgets(line, 128, stdin);
                        strip(line);
                        if (line[0] == '?') {
                                print_help(menu);
                        strip(line);
                        if (line[0] == '?') {
                                print_help(menu);
@@ -644,3 +644,14 @@ int main(int ac, char **av)
        }
        return 0;
 }
        }
        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");
+}