lkml.org 
[lkml]   [2011]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.6.38-rc6] build:mkpiggy fixlet...
On Wed, Feb 23, 2011 at 09:33:59AM +0800, Daniel J Blueman wrote:
>Ensure build doesn't silently continue despite read failure,
>addressing a warning due to the unchecked call.
>
>Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
>
>diff --git a/arch/x86/boot/compressed/mkpiggy.c
>b/arch/x86/boot/compressed/mkpiggy.c
>index 646aa78..845a1f8 100644
>--- a/arch/x86/boot/compressed/mkpiggy.c
>+++ b/arch/x86/boot/compressed/mkpiggy.c
>@@ -62,7 +62,12 @@ int main(int argc, char *argv[])
> if (fseek(f, -4L, SEEK_END)) {
> perror(argv[1]);
> }
>- fread(&olen, sizeof olen, 1, f);
>+
>+ if (fread(&olen, sizeof(olen), 1, f) != 1) {
>+ perror(argv[1]);
>+ return 1;


You need to close the file here...


>+ }
>+
> ilen = ftell(f);
> olen = getle32(&olen);
> fclose(f);

Thanks.


\
 
 \ /
  Last update: 2011-02-28 17:29    [W:0.060 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site