aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJean Sacren <sakiwit@gmail.com>2010-08-04 18:03:16 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-12 18:40:35 -0400
commit4418a2b904805814bbd14b555d6add6a175f49f3 (patch)
tree73b41b852845f4097c173eac657fd74811ca0505 /scripts
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')
-rw-r--r--scripts/kconfig/conf.c15
-rw-r--r--scripts/kconfig/lkc.h3
2 files changed, 16 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)
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 */
650void 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}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 2ac33f5d273c..bdf71bd31412 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -72,6 +72,9 @@ void zconf_nextfile(const char *name);
72int zconf_lineno(void); 72int zconf_lineno(void);
73char *zconf_curname(void); 73char *zconf_curname(void);
74 74
75/* conf.c */
76void xfgets(char *str, int size, FILE *in);
77
75/* confdata.c */ 78/* confdata.c */
76const char *conf_get_configname(void); 79const char *conf_get_configname(void);
77const char *conf_get_autoconfig_name(void); 80const char *conf_get_autoconfig_name(void);