Skip to contentSkip to conversation

scripts: Enable error messages while hush up unnecessary warnings

PATCH Applied Jean Sacren 2 participants 3 messages Sep 11, 2010 – Sep 29, 2010

lore
Share & tools
lore
#0 lore raw

cover scripts: Enable error messages while hush up unnecessary warnings

Hi,

We need to know when fgets() returns with error or end of file, but the assignment approach deprives us of such information. Also, the fix properly handles the unnecessary warnings. What a deal!

Jean Sacren (1):
scripts: Enable error messages while hush up unnecessary warnings

 scripts/kallsyms.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
Signature · 2 lines
Jean Sacren
Bring LAMP To People
#1 lore raw

PATCH 1/1 scripts: Enable error messages while hush up unnecessary warnings

As no error was handled, we wouldn't be able to know when an error does occur. The fix preserves error messages while it doesn't let unnecessary compiling warnings show up.

---
 scripts/kallsyms.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
scripts/kallsyms.c +2 -6
index e3902fb..60dd3eb 100644
@@ -107,12 +107,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 
 	rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
 	if (rc != 3) {
-		if (rc != EOF) {
-			/* skip line. sym is used as dummy to
-			 * shut of "warn_unused_result" warning.
-			 */
-			sym = fgets(str, 500, in);
-		}
+		if (rc != EOF && fgets(str, 500, in) == NULL)
+			fprintf(stderr, "Read error or end of file.\n");
 		return -1;
 	}
 
Signature · 1 line
1.7.1
Applied
#2 lore raw
Quoted 8 lines · Jean Sacren

As no error was handled, we wouldn't be able to know when an error does occur. The fix preserves error messages while it doesn't let unnecessary compiling warnings show up.

---
 scripts/kallsyms.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

Thanks, applied.

Michal