Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 25 Dec 2012 00:01:17 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: charset.c warnings

Lukas -

On Mon, Dec 24, 2012 at 02:48:30AM +0100, Lukas Odzioba wrote:
> charset.c: In function ?charset_generate_chars?:
> charset.c:180:8: warning: ignoring return value of ?fwrite?, declared
> with attribute warn_unused_result

Yeah, I expected that we'd start getting these eventually.  First they
added warnings for fread(), now also for fwrite().

> It can be easily fixed by:
> #define gently_fwrite(src,size,cnt,file)
> if(size!=0&&fwrite(src,size,cnt,file)!=cnt) fprintf(stderr,"fwrite()
> error in file (%s) at line (%s)",__FILE__,__LINE__);
> 
> +undef at the end of file
> 
> but, maybe there are better/preffered ways to do that.
> Yes, it is unlikely to have errors with that calls but when bad things
> happen, detailed info is priceless.

The code currently checks ferror() right before fclose(), and it also
checks fclose() return value.  I think this is sufficient (IIRC, I did
test it with insufficient space on the filesystem), and I think more
detailed reporting is not needed here.  However, to silence compiler
warnings I may implement something similar to what I did for fread().

Alexander

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ