[pacman-dev] Warnings with -D_FORTIFY_SOURCE=2

Dan McGee dpmcgee at gmail.com
Mon Jun 14 11:18:40 EDT 2010


On Mon, Jun 14, 2010 at 5:16 AM, Xavier Chantry
<chantry.xavier at gmail.com> wrote:
> On Mon, Jun 14, 2010 at 11:35 AM, Allan McRae <allan at archlinux.org> wrote:
>> Hi,
>>
>> Trying to build pacman with the gcc flag -D_FORTIFY_SOURCE=2 gives a bunch
>> of warnings like:
>>
>> add.c:586:8: warning: ignoring return value of ‘chdir’, declared with
>> attribute warn_unused_result
>> be_files.c:660:9: warning: ignoring return value of ‘fgets’, declared with
>> attribute warn_unused_result
>> util.c:146:9: warning: ignoring return value of ‘fwrite’, declared with
>> attribute warn_unused_result
>> pacman.c:712:8: warning: ignoring return value of ‘getcwd’, declared with
>> attribute warn_unused_result
>> util.c:796:12: warning: ignoring return value of ‘asprintf’, declared with
>> attribute warn_unused_result
>>
>> There are 21 warnings in total.  Would there be in interest in adding the
>> return value check (some of which would be basically useless...) and adding
>> -D_FORTIFY_SOURCE=2 to the CFLAGS when used with --enable-debug?
>>
>
> If it's easy to check (because the function already does some error
> handling, or it is easy to add), then go for it.

Sounds fine with me, although is there any way we can use an autoconf
macro similar to the one we use for the stack protector? Although
given that it is just a define that should not matter...

-Dan


More information about the pacman-dev mailing list