summaryrefslogtreecommitdiff
path: root/scripts/kconfig/conf.c
diff options
context:
space:
mode:
authorJean Sacren <sakiwit@gmail.com>2010-08-04 16:03:16 -0600
committerMichal Marek <mmarek@suse.cz>2010-08-13 00:40:35 +0200
commit4418a2b904805814bbd14b555d6add6a175f49f3 (patch)
tree73b41b852845f4097c173eac657fd74811ca0505 /scripts/kconfig/conf.c
parentbf5e327a300a9ac959a89440e7c67dc89f3bd804 (diff)
kconfig: Fix warning: ignoring return value of 'fgets'
This fix facilitates fgets() either it returns on success or on error or when end of file occurs. Signed-off-by: Jean Sacren <sakiwit@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
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 010600ef58c0..4f0ed5b3a75e 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");
+}