Skip to contentSkip to conversation

mkpiggy.c fixes compiler warning

PATCH In review Christoph Fritz 2 participants 2 messages Mar 14, 2010 – Mar 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkpiggy.c fixes compiler warning

fixes compiler warning (ignoring return value of 'fread', declared with attribute warn_unused_result) and fseek error returns now

---
 arch/x86/boot/compressed/mkpiggy.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/boot/compressed/mkpiggy.c +5 -1
index bcbd36c..78d14d2 100644
@@ -61,8 +61,12 @@ int main(int argc, char *argv[])
 
 	if (fseek(f, -4L, SEEK_END)) {
 		perror(argv[1]);
+		return 1;
+	}
+	if (fread(&olen, sizeof olen, 1, f) != 1) {
+		perror(argv[1]);
+		return 1;
 	}
-	fread(&olen, sizeof olen, 1, f);
 	ilen = ftell(f);
 	olen = getle32(&olen);
 	fclose(f);
Signature · 1 line
1.5.6.5
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Christoph Fritz

fixes compiler warning (ignoring return value of 'fread', declared with attribute warn_unused_result) and fseek error returns now

---
 arch/x86/boot/compressed/mkpiggy.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/boot/compressed/mkpiggy.c +0 -0
index bcbd36c..78d14d2 100644
@@ -61,8 +61,12 @@ int main(int argc, char *argv[])
 
 	if (fseek(f, -4L, SEEK_END)) {
 		perror(argv[1]);

arch/x86/boot/compressed/mkpiggy.c int main(int argc, char *argv[]) · line 72

Quoted 10 lines
arch/x86/boot/compressed/mkpiggy.c +5 -1
+		return 1;
+	}
+	if (fread(&olen, sizeof olen, 1, f) != 1) {
+		perror(argv[1]);
+		return 1;
 	}
-	fread(&olen, sizeof olen, 1, f);
 	ilen = ftell(f);
 	olen = getle32(&olen);
 	fclose(f);

Hi Christoph,

this looks good to me, so you can add a:

Now you have to send it to the responsible maintainer(s).
Take a look at MAINTAINERS or better use ./scripts/get_maintainer.pl --roles -f <your patchfile> .

Greets,
Henrik