On 08/25/2010 05:09 PM, Jean Sacren wrote: > warning: ignoring return value of 'fread', declared with attribute > warn_unused_result > > This fix facilitates fread() either it succeeds, or an error occurs or > the end of file is reached. > > Signed-off-by: Jean Sacren <sakiwit@xxxxxxxxx> > --- > arch/x86/boot/compressed/mkpiggy.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c > index 5c22812..fac37c3 100644 > --- a/arch/x86/boot/compressed/mkpiggy.c > +++ b/arch/x86/boot/compressed/mkpiggy.c > @@ -62,7 +62,10 @@ 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) > + fprintf(stderr, "\nError in reading or end of file.\n"); > + > ilen = ftell(f); > olen = getle32(&olen); > fclose(f); I usually prefer the style: if (fread(&olen, 1, sizeof olen, f) != sizeof olen) ... for consistency with plain write(). It's a minor nitpick, though. -hpa -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html