* kbuild warning fixes
@ 2010-05-25 0:50 Ben Dooks
2010-05-25 0:50 ` [PATCH] kbuild: kallsysms: throw away result of fgets() Ben Dooks
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ben Dooks @ 2010-05-25 0:50 UTC (permalink / raw)
To: linux-kernel, linux-kbuild
couple of fixes to deal with the unused result of fgets().
note sure if they are the best, but they do fix the warnings
without totally throwing the result away.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] kbuild: kallsysms: throw away result of fgets()
2010-05-25 0:50 kbuild warning fixes Ben Dooks
@ 2010-05-25 0:50 ` Ben Dooks
2010-05-25 0:51 ` Ben Dooks
2010-05-25 0:51 ` [PATCH 190/190] kbuild: fix unused return value from fgets() Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2010-05-25 0:50 UTC (permalink / raw)
To: linux-kernel, linux-kbuild; +Cc: Ben Dooks
fgets() is being used to skip a line, so throw the result away
to remove the following warning:
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:112: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
---
scripts/kallsyms.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 86c3896..87c3d38 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -109,7 +109,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
if (rc != 3) {
if (rc != EOF) {
/* skip line */
- fgets(str, 500, in);
+ char *tmp = fgets(str, 500, in);
+
+ /* shut unused-result warning up */
+ if (!tmp)
+ str[0] = '\0';
}
return -1;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] kbuild: kallsysms: throw away result of fgets()
2010-05-25 0:50 kbuild warning fixes Ben Dooks
2010-05-25 0:50 ` [PATCH] kbuild: kallsysms: throw away result of fgets() Ben Dooks
@ 2010-05-25 0:51 ` Ben Dooks
2010-05-25 0:51 ` [PATCH 190/190] kbuild: fix unused return value from fgets() Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2010-05-25 0:51 UTC (permalink / raw)
To: linux-kernel, linux-kbuild; +Cc: Ben Dooks
fgets() is being used to skip a line, so throw the result away
to remove the following warning:
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:112: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
tmp-fix-kallsysms
---
scripts/kallsyms.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 86c3896..87c3d38 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -109,7 +109,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
if (rc != 3) {
if (rc != EOF) {
/* skip line */
- fgets(str, 500, in);
+ char *tmp = fgets(str, 500, in);
+
+ /* shut unused-result warning up */
+ if (!tmp)
+ str[0] = '\0';
}
return -1;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 190/190] kbuild: fix unused return value from fgets()
2010-05-25 0:50 kbuild warning fixes Ben Dooks
2010-05-25 0:50 ` [PATCH] kbuild: kallsysms: throw away result of fgets() Ben Dooks
2010-05-25 0:51 ` Ben Dooks
@ 2010-05-25 0:51 ` Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2010-05-25 0:51 UTC (permalink / raw)
To: linux-kernel, linux-kbuild; +Cc: Ben Dooks
fgets() returns a pointer to the string on success, or NULL otherwise
but the current configuration code ignores this, producing the following
warning on some systems:
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:105: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
scripts/kconfig/conf.c: In function ‘conf_choice’:
cripts/kconfig/conf.c:307: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
Use the result to ensure that on error, the linebuffer is terminated
at the first entry.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
---
scripts/kconfig/conf.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 9960d1c..83c5e24 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -78,6 +78,7 @@ static void check_stdin(void)
static int conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
+ char *r;
if (!sym_has_value(sym))
printf(_("(NEW) "));
@@ -102,7 +103,9 @@ static int conf_askvalue(struct symbol *sym, const char *def)
check_stdin();
case ask_all:
fflush(stdout);
- fgets(line, 128, stdin);
+ r = fgets(line, 128, stdin);
+ if (!r)
+ line[0] = '\0';
return 1;
default:
break;
@@ -259,6 +262,7 @@ static int conf_choice(struct menu *menu)
while (1) {
int cnt, def;
+ char *r;
printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
def_sym = sym_get_choice_value(sym);
@@ -304,7 +308,9 @@ static int conf_choice(struct menu *menu)
check_stdin();
case ask_all:
fflush(stdout);
- fgets(line, 128, stdin);
+ r = fgets(line, 128, stdin);
+ if (!r)
+ line[0] = '\0';
strip(line);
if (line[0] == '?') {
print_help(menu);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-25 0:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 0:50 kbuild warning fixes Ben Dooks
2010-05-25 0:50 ` [PATCH] kbuild: kallsysms: throw away result of fgets() Ben Dooks
2010-05-25 0:51 ` Ben Dooks
2010-05-25 0:51 ` [PATCH 190/190] kbuild: fix unused return value from fgets() Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).