Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 Dec 2012 02:48:30 +0100
From: Lukas Odzioba <lukas.odzioba@...il.com>
To: john-dev@...ts.openwall.com
Subject: charset.c warnings

magnum,all:

I compiled john on 32bit OS and got:

charset.c: In function ‘charset_generate_chars’:
charset.c:180:8: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
charset.c:233:11: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
charset.c: In function ‘charset_write_header’:
charset.c:96:8: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
charset.c:97:8: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
charset.c:102:8: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
charset.c:103:8: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result

Here are problematic lines:

        fwrite(header->version, sizeof(header->version), 1, file);
        fwrite(header->check, sizeof(header->check), 1, file);
        fwrite(header->offsets, sizeof(header->offsets), 1, file);
        fwrite(header->order, sizeof(header->order), 1, file);
        fwrite(buffer, 1, count, file);
        fwrite(buffer, 1, count, file);

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.

Lukas

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.